Dan Carpenter
2016-Dec-12 11:59 UTC
[Nouveau] [bug report] drm/nouveau/imem: convert to new-style nvkm_subdev
[ 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
Ilia Mirkin
2016-Dec-12 12:22 UTC
[Nouveau] [bug report] drm/nouveau/imem: convert to new-style nvkm_subdev
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. On Dec 12, 2016 7:07 AM, "Dan Carpenter" <dan.carpenter at oracle.com> wrote:> [ 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 > Nouveau at lists.freedesktop.org > https://lists.freedesktop.org/mailman/listinfo/nouveau >-------------- next part -------------- An HTML attachment was scrubbed... URL: <https://lists.freedesktop.org/archives/nouveau/attachments/20161212/83d46172/attachment.html>
Possibly Parallel Threads
- [PATCH] drm/nouveau: Fixup gk20a instobj hierarchy
- [PATCH] drm/nouveau: Fixup gk20a instobj hierarchy
- [PATCH] drm/nouveau/imem/nv50: fix incorrect use of refcount API
- [PATCH] drm/nouveau/imem/nv50: fix incorrect use of refcount API
- [PATCH] drm/nouveau: gk20a: Turn instmem lock into mutex