re: drm/nouveau/bios: fetch the vbios from PROM using only aligned 32-bit accesses

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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
_______________________________________________
dri-devel mailing list
dri-devel@xxxxxxxxxxxxxxxxxxxxx
http://lists.freedesktop.org/mailman/listinfo/dri-devel




[Index of Archives]     [Linux DRI Users]     [Linux Intel Graphics]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [XFree86]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [XFree86]
  Powered by Linux