From: Rasmus Villemoes <linux@rasmusvillemoes.dk>
To: kbuild test robot <lkp@intel.com>
Cc: kbuild-all@01.org, David Airlie <airlied@linux.ie>,
dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH 1/2] drm/vmwgfx: use kzalloc in vmw_surface_define_ioctl()
Date: Wed, 30 Sep 2015 23:08:20 +0200 [thread overview]
Message-ID: <87vbarehtn.fsf@rasmusvillemoes.dk> (raw)
In-Reply-To: <201510010454.nwCLjpXA%fengguang.wu@intel.com> (kbuild test robot's message of "Thu, 1 Oct 2015 04:54:47 +0800")
On Wed, Sep 30 2015, kbuild test robot <lkp@intel.com> wrote:
> Hi Rasmus,
>
> [auto build test results on v4.3-rc3 -- if it's inappropriate base, please ignore]
>
>
> coccinelle warnings: (new ones prefixed by >>)
>
>>> drivers/gpu/drm/vmwgfx/vmwgfx_surface.c:771:1-13: alloc with no test, possible model on line 817
>
> vim +771 drivers/gpu/drm/vmwgfx/vmwgfx_surface.c
>
> 543831cf Thomas Hellstrom 2012-11-20 765
> 543831cf Thomas Hellstrom 2012-11-20 766 srf->sizes = kmalloc(srf->num_sizes * sizeof(*srf->sizes), GFP_KERNEL);
> 543831cf Thomas Hellstrom 2012-11-20 767 if (unlikely(srf->sizes == NULL)) {
> 543831cf Thomas Hellstrom 2012-11-20 768 ret = -ENOMEM;
> 543831cf Thomas Hellstrom 2012-11-20 769 goto out_no_sizes;
> 543831cf Thomas Hellstrom 2012-11-20 770 }
> 543831cf Thomas Hellstrom 2012-11-20 @771 srf->offsets = kmalloc(srf->num_sizes * sizeof(*srf->offsets),
> 543831cf Thomas Hellstrom 2012-11-20 772 GFP_KERNEL);
> 543831cf Thomas Hellstrom 2012-11-20 773 if (unlikely(srf->sizes == NULL)) {
> 543831cf Thomas Hellstrom 2012-11-20 774 ret = -ENOMEM;
> 543831cf Thomas Hellstrom 2012-11-20 775 goto out_no_offsets;
> 543831cf Thomas Hellstrom 2012-11-20 776 }
> 543831cf Thomas Hellstrom 2012-11-20 777
Wauv, that was fast. So, I'm pretty sure this has nothing to do with the
patch I just sent, but there's a bug nevertheless. The NULL test has
been copy-pasted from just above, but we're testing srf->sizes again,
not srf->offsets which we just tried to allocate.
Subject: [PATCH] drm/vmwgfx: check kmalloc return value
srf->sizes has been allocated and checked a few lines above; fix up
the copy-pasto so that we check srf->offsets.
Reported-by: kbuild test robot <lkp@intel.com>
Signed-off-by: Rasmus Villemoes <linux@rasmusvillemoes.dk>
---
drivers/gpu/drm/vmwgfx/vmwgfx_surface.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/gpu/drm/vmwgfx/vmwgfx_surface.c b/drivers/gpu/drm/vmwgfx/vmwgfx_surface.c
index 64b50409fa07..0cf0055e0e08 100644
--- a/drivers/gpu/drm/vmwgfx/vmwgfx_surface.c
+++ b/drivers/gpu/drm/vmwgfx/vmwgfx_surface.c
@@ -770,7 +770,7 @@ int vmw_surface_define_ioctl(struct drm_device *dev, void *data,
}
srf->offsets = kmalloc(srf->num_sizes * sizeof(*srf->offsets),
GFP_KERNEL);
- if (unlikely(srf->sizes == NULL)) {
+ if (unlikely(srf->offsets == NULL)) {
ret = -ENOMEM;
goto out_no_offsets;
}
prev parent reply other threads:[~2015-09-30 21:08 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-09-30 19:53 [PATCH 1/2] drm/vmwgfx: use kzalloc in vmw_surface_define_ioctl() Rasmus Villemoes
2015-09-30 19:53 ` [PATCH 2/2] drm/omap: use kzalloc in sita_init() Rasmus Villemoes
2015-09-30 20:54 ` [PATCH 1/2] drm/vmwgfx: use kzalloc in vmw_surface_define_ioctl() kbuild test robot
2015-09-30 21:08 ` Rasmus Villemoes [this message]
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=87vbarehtn.fsf@rasmusvillemoes.dk \
--to=linux@rasmusvillemoes.dk \
--cc=airlied@linux.ie \
--cc=dri-devel@lists.freedesktop.org \
--cc=kbuild-all@01.org \
--cc=linux-kernel@vger.kernel.org \
--cc=lkp@intel.com \
/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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox