From: Thomas Hellstrom <thellstrom@vmware.com>
To: kernel-janitors@vger.kernel.org
Subject: Re: drivers/gpu/drm/vmwgfx/vmwgfx_resource.c: alloc with no test
Date: Mon, 17 Sep 2012 06:46:27 +0000 [thread overview]
Message-ID: <5056C743.8000708@vmware.com> (raw)
In-Reply-To: <20120917003446.GA12394@localhost>
Hi,
You're right. The line below tests for sizes instead of offsets. I'm
about to fix this in an upcoming patch
series, so I won't submit a separate patch for this.
Thanks,
Thomas
On 09/17/2012 02:34 AM, Fengguang Wu wrote:
> 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
next prev parent reply other threads:[~2012-09-17 6:46 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
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 [this message]
2012-09-17 7:11 ` Fengguang Wu
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=5056C743.8000708@vmware.com \
--to=thellstrom@vmware.com \
--cc=kernel-janitors@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.