public inbox for kernel-janitors@vger.kernel.org
 help / color / mirror / Atom feed
* drivers/gpu/drm/vmwgfx/vmwgfx_resource.c: alloc with no test
@ 2012-09-17  0:34 Fengguang Wu
  2012-09-17  6:46 ` Thomas Hellstrom
  2012-09-17  7:11 ` Fengguang Wu
  0 siblings, 2 replies; 3+ messages in thread
From: Fengguang Wu @ 2012-09-17  0:34 UTC (permalink / raw)
  To: kernel-janitors

Hi Thomas,

FYI, coccinelle warns about

drivers/gpu/drm/vmwgfx/vmwgfx_resource.c:1355:1-13: alloc with no test, possible model on line 1402

vim +1355 drivers/gpu/drm/vmwgfx/vmwgfx_resource.c
  1345	
  1346		memcpy(srf->mip_levels, req->mip_levels, sizeof(srf->mip_levels));
  1347		srf->num_sizes = num_sizes;
  1348		user_srf->size = size;
  1349	
  1350		srf->sizes = kmalloc(srf->num_sizes * sizeof(*srf->sizes), GFP_KERNEL);
  1351		if (unlikely(srf->sizes = NULL)) {
  1352			ret = -ENOMEM;
  1353			goto out_no_sizes;
  1354		}
> 1355		srf->offsets = kmalloc(srf->num_sizes * sizeof(*srf->offsets),
  1356				       GFP_KERNEL);
  1357		if (unlikely(srf->sizes = NULL)) {
  1358			ret = -ENOMEM;
  1359			goto out_no_offsets;
  1360		}
  1361	
  1362		user_sizes = (struct drm_vmw_size __user *)(unsigned long)
  1363		    req->size_addr;
  1364	
  1365		ret = copy_from_user(srf->sizes, user_sizes,

Which is likely a copy/paste error introduced by commit

        commit 5bb39e818169783ee17ddbbefbd7bd16a4383fec
        Author:     Thomas Hellstrom <thellstrom@vmware.com>
        AuthorDate: Tue Oct 4 20:13:33 2011 +0200
        Commit:     Dave Airlie <airlied@redhat.com>
        CommitDate: Wed Oct 5 10:17:31 2011 +0100

Thanks,
Fengguang

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2012-09-17  7:11 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-09-17  0:34 drivers/gpu/drm/vmwgfx/vmwgfx_resource.c: alloc with no test Fengguang Wu
2012-09-17  6:46 ` Thomas Hellstrom
2012-09-17  7:11 ` Fengguang Wu

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox