lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <87vbarehtn.fsf@rasmusvillemoes.dk>
Date:	Wed, 30 Sep 2015 23:08:20 +0200
From:	Rasmus Villemoes <linux@...musvillemoes.dk>
To:	kbuild test robot <lkp@...el.com>
Cc:	kbuild-all@...org, David Airlie <airlied@...ux.ie>,
	dri-devel@...ts.freedesktop.org, linux-kernel@...r.kernel.org
Subject: Re: [PATCH 1/2] drm/vmwgfx: use kzalloc in vmw_surface_define_ioctl()

On Wed, Sep 30 2015, kbuild test robot <lkp@...el.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@...el.com>
Signed-off-by: Rasmus Villemoes <linux@...musvillemoes.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;
 	}

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ