* re: drm/nouveau/bios: fetch the vbios from PROM using only aligned 32-bit accesses
@ 2014-04-02 16:55 Dan Carpenter
0 siblings, 0 replies; only message in thread
From: Dan Carpenter @ 2014-04-02 16:55 UTC (permalink / raw)
To: martin.peres; +Cc: dri-devel
Hello Martin Peres,
The patch 18acc6d84eba: "drm/nouveau/bios: fetch the vbios from PROM
using only aligned 32-bit accesses" from Mar 25, 2014, leads to the
following static checker warning:
drivers/gpu/drm/nouveau/core/subdev/bios/base.c:191 nouveau_bios_shadow_prom()
error: potential null dereference 'bios->data'. (kmalloc returns null)
drivers/gpu/drm/nouveau/core/subdev/bios/base.c
178 /* read entire bios image to system memory */
179 bios->size = ((nv_rd32(bios, 0x300000) >> 16) & 0xff) * 512;
180 if (!bios->size)
181 goto out;
182
183 bios->data = kmalloc(bios->size, GFP_KERNEL);
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Allocation.
184 if (bios->data) {
185 for (i = 0; i < bios->size; i+=4)
186 nv_wo32(bios, i, nv_rd32(bios, 0x300000 + i));
187 }
188
189 /* check the PCI record header */
190 pcir = nv_ro16(bios, 0x0018);
191 if (bios->data[pcir + 0] != 'P' ||
^^^^^^^^^^^^^^^^^^^^
NULL deref.
192 bios->data[pcir + 1] != 'C' ||
193 bios->data[pcir + 2] != 'I' ||
194 bios->data[pcir + 3] != 'R') {
195 bios->size = 0;
196 kfree(bios->data);
197 }
198
199 out:
200 /* disable access to rom */
201 nv_wr32(bios, pcireg, access);
202 }
regards,
dan carpenter
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2014-04-02 16:55 UTC | newest]
Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-04-02 16:55 drm/nouveau/bios: fetch the vbios from PROM using only aligned 32-bit accesses Dan Carpenter
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox