re: drm/nouveau/fb: namespace + nvidia gpu names (no binary change)

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

 



Hello Ben Skeggs,

The patch 639c308effb9: "drm/nouveau/fb: namespace + nvidia gpu names
(no binary change)" from Jan 14, 2015, leads to the following static
checker warning:

	drivers/gpu/drm/nouveau/nvkm/subdev/fb/ramgk104.c:1297 gk104_ram_train_init()
	error: potential null dereference 'train'.  (kzalloc returns null)

drivers/gpu/drm/nouveau/nvkm/subdev/fb/ramgk104.c
  1280  static int
  1281  gk104_ram_train_init(struct nvkm_fb *pfb)
  1282  {
  1283          u8 ramcfg = nvbios_ramcfg_index(nv_subdev(pfb));
  1284          struct gk104_ram_train *train;
  1285          int ret = -ENOMEM, i;
  1286  
  1287          if ((train = kzalloc(sizeof(*train), GFP_KERNEL))) {
                     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Assume the allocation fails.

  1288                  for (i = 0; i < 0x100; i++) {
  1289                          ret = gk104_ram_train_type(pfb, i, ramcfg, train);
  1290                          if (ret && ret != -ENOENT)
  1291                                  break;
  1292                  }
  1293          }
  1294  
  1295          switch (pfb->ram->type) {
  1296          case NV_MEM_TYPE_GDDR5:
  1297                  ret = gk104_ram_train_init_0(pfb, train);
                                                          ^^^^^
Dereferenced inside the gk104_ram_train_init_0() function.

  1298                  break;
  1299          default:
  1300                  ret = 0;
  1301                  break;
  1302          }
  1303  
  1304          kfree(train);
  1305          return ret;
  1306  }

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