diff options
author | Martin Peres <martin.peres@free.fr> | 2014-04-03 16:12:41 -0400 |
---|---|---|
committer | Ben Skeggs <bskeggs@redhat.com> | 2014-06-10 02:05:51 -0400 |
commit | 29ba8c8abf9729b0091eccf9f7044f6940d789d0 (patch) | |
tree | 54f61bdec085633a244a773ae41c91cec3d9fe7c | |
parent | 9044fa60fd8455b34c259fb46178bf67274f2910 (diff) |
drm/nouveau/bios: fix a potential NULL deref in the PROM shadowing function
Reported-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Martin Peres <martin.peres@free.fr>
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
-rw-r--r-- | drivers/gpu/drm/nouveau/core/subdev/bios/base.c | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/drivers/gpu/drm/nouveau/core/subdev/bios/base.c b/drivers/gpu/drm/nouveau/core/subdev/bios/base.c index 222e8ebb669d..d45704a2c2df 100644 --- a/drivers/gpu/drm/nouveau/core/subdev/bios/base.c +++ b/drivers/gpu/drm/nouveau/core/subdev/bios/base.c | |||
@@ -183,10 +183,11 @@ nouveau_bios_shadow_prom(struct nouveau_bios *bios) | |||
183 | goto out; | 183 | goto out; |
184 | 184 | ||
185 | bios->data = kmalloc(bios->size, GFP_KERNEL); | 185 | bios->data = kmalloc(bios->size, GFP_KERNEL); |
186 | if (bios->data) { | 186 | if (!bios->data) |
187 | for (i = 0; i < bios->size; i += 4) | 187 | goto out; |
188 | ((u32 *)bios->data)[i/4] = nv_rd32(bios, 0x300000 + i); | 188 | |
189 | } | 189 | for (i = 0; i < bios->size; i += 4) |
190 | ((u32 *)bios->data)[i/4] = nv_rd32(bios, 0x300000 + i); | ||
190 | 191 | ||
191 | /* check the PCI record header */ | 192 | /* check the PCI record header */ |
192 | pcir = nv_ro16(bios, 0x0018); | 193 | pcir = nv_ro16(bios, 0x0018); |