Skip to contentSkip to conversation

drm/nouveau/imem: convert to new-style nvkm_subdev

bug report Dan Carpenter 2 participants 2 messages Dec 12, 2016 1 message not in the archive

lore
Share & tools
lore
#0 lore raw

[ No idea why it's only complaining about this a year later... -dan ]

Hello Ben Skeggs,

This is a semi-automatic email about new static checker warnings.

The patch b7a2bc1886d0: "drm/nouveau/imem: convert to new-style nvkm_subdev" from Aug 20, 2015, leads to the following Smatch complaint:

drivers/gpu/drm/nouveau/nvkm/subdev/instmem/gk20a.c:536 gk20a_instobj_new()
error: we previously assumed 'node' could be null (see line 532)

drivers/gpu/drm/nouveau/nvkm/subdev/instmem/gk20a.c
531 align, &node);

   532		*pmemory = node ? &node->memory : NULL;
                           ^^^^

Added a new check for NULL.

533 if (ret)
534 return ret;
535

   536		node->imem = imem;
                ^^^^^^^^^^

Unchecked dereference.

537
538 /* present memory for being mapped using small pages */

regards,
dan carpenter
_______________________________________________
Nouveau mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/nouveau

A message that is not in the archive (sent off-list or not yet received): [email protected]

#2 lore raw

If ret == 0, then node should not be null. Either that no longer holds, or your static checker is no longer able to deduce that.

Quoted 30 lines · Dan Carpenter

[ No idea why it's only complaining about this a year later... -dan ]

Hello Ben Skeggs,

This is a semi-automatic email about new static checker warnings.

The patch b7a2bc1886d0: "drm/nouveau/imem: convert to new-style nvkm_subdev" from Aug 20, 2015, leads to the following Smatch complaint:

drivers/gpu/drm/nouveau/nvkm/subdev/instmem/gk20a.c:536 gk20a_instobj_new()
error: we previously assumed 'node' could be null (see line 532)

drivers/gpu/drm/nouveau/nvkm/subdev/instmem/gk20a.c

   531                                               align, &node);
   532          *pmemory = node ? &node->memory : NULL;
                           ^^^^

Added a new check for NULL.

   533          if (ret)
   534                  return ret;
   535
   536          node->imem = imem;
                ^^^^^^^^^^

Unchecked dereference.

537
538 /* present memory for being mapped using small pages */

Quoted 7 lines

regards,
dan carpenter
_______________________________________________
Nouveau mailing list [email protected]
https://lists.freedesktop.org/mailman/listinfo/nouveau

_______________________________________________
Nouveau mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/nouveau