drm/nouveau/bios/pll: prevent oops when limits table can't be parsed
authorBen Skeggs <bskeggs@redhat.com>
Tue, 19 Apr 2016 00:07:04 +0000 (10:07 +1000)
committerBen Skeggs <bskeggs@redhat.com>
Fri, 20 May 2016 04:43:04 +0000 (14:43 +1000)
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
drivers/gpu/drm/nouveau/nvkm/subdev/bios/pll.c

index 125ec2ed6c2e007ee36e51ac67bb3b28ed955f71..4cd3d6502e20db8c49ae0bc7a260cf58c4cfa749 100644 (file)
@@ -156,7 +156,7 @@ pll_map_reg(struct nvkm_bios *bios, u32 reg, u32 *type, u8 *ver, u8 *len)
        }
 
        map = pll_map(bios);
-       while (map->reg) {
+       while (map && map->reg) {
                if (map->reg == reg && *ver >= 0x20) {
                        u16 addr = (data += hdr);
                        *type = map->type;
@@ -198,7 +198,7 @@ pll_map_type(struct nvkm_bios *bios, u8 type, u32 *reg, u8 *ver, u8 *len)
        }
 
        map = pll_map(bios);
-       while (map->reg) {
+       while (map && map->reg) {
                if (map->type == type && *ver >= 0x20) {
                        u16 addr = (data += hdr);
                        *reg = map->reg;