Commit acac7bdb authored by Ben Skeggs's avatar Ben Skeggs

drm/nouveau/bios: check that fixed tvdac gpio data is valid before using it

Signed-off-by: default avatarBen Skeggs <bskeggs@redhat.com>
parent da07e52c
...@@ -100,13 +100,17 @@ dcb_gpio_parse(struct nouveau_bios *bios, int idx, u8 func, u8 line, ...@@ -100,13 +100,17 @@ dcb_gpio_parse(struct nouveau_bios *bios, int idx, u8 func, u8 line,
/* DCB 2.2, fixed TVDAC GPIO data */ /* DCB 2.2, fixed TVDAC GPIO data */
if ((entry = dcb_table(bios, &ver, &hdr, &cnt, &len)) && ver >= 0x22) { if ((entry = dcb_table(bios, &ver, &hdr, &cnt, &len)) && ver >= 0x22) {
if (func == DCB_GPIO_TVDAC0) { if (func == DCB_GPIO_TVDAC0) {
*gpio = (struct dcb_gpio_func) { u8 conf = nv_ro08(bios, entry - 5);
.func = DCB_GPIO_TVDAC0, u8 addr = nv_ro08(bios, entry - 4);
.line = nv_ro08(bios, entry - 4) >> 4, if (conf & 0x01) {
.log[0] = !!(nv_ro08(bios, entry - 5) & 2), *gpio = (struct dcb_gpio_func) {
.log[1] = !(nv_ro08(bios, entry - 5) & 2), .func = DCB_GPIO_TVDAC0,
}; .line = addr >> 4,
return 0; .log[0] = !!(conf & 0x02),
.log[1] = !(conf & 0x02),
};
return 0;
}
} }
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment