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] [thread-next>] [day] [month] [year] [list]
Message-ID: <35c2d89987854fb8a42f04dc28ad4bc9@AcuMS.aculab.com>
Date:   Tue, 1 Oct 2019 16:00:20 +0000
From:   David Laight <David.Laight@...LAB.COM>
To:     "'efremov@...ux.com'" <efremov@...ux.com>,
        'Dan Carpenter' <dan.carpenter@...cle.com>
CC:     "devel@...verdev.osuosl.org" <devel@...verdev.osuosl.org>,
        Jes Sorensen <jes.sorensen@...il.com>,
        Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
        "linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>,
        "stable@...r.kernel.org" <stable@...r.kernel.org>,
        Hans de Goede <hdegoede@...hat.com>,
        Bastien Nocera <hadess@...ess.net>,
        Dmitry Vyukov <dvyukov@...gle.com>,
        Larry Finger <Larry.Finger@...inger.net>
Subject: RE: [PATCH] staging: rtl8723bs: hal: Fix memcpy calls

From: Denis Efremov
> Sent: 01 October 2019 16:13
...
> Just found an official documentation to this issue:
> https://gcc.gnu.org/gcc-4.9/porting_to.html
> "Null pointer checks may be optimized away more aggressively
> ...
> The pointers passed to memmove (and similar functions in <string.h>) must be non-null
> even when nbytes==0, so GCC can use that information to remove the check after the
> memmove call. Calling copy(p, NULL, 0) can therefore deference a null pointer and crash."

Right, so just don't code a NULL pointer test after a memcpy() call.
There is no need to avoid the call itself.

> But again, I would say that the bug in this code is because the if condition was copy-pasted
> and it should be inverted.

Oh, the code is question is just stupidly bad.
It seemed to do:
	if (a)
		x;
	else if (!a)
		y;
	else
		error ("all borked")

If the whole driver is written like that it needs fixing before anyone takes a serious look at it.

	David

-
Registered Address Lakeside, Bramley Road, Mount Farm, Milton Keynes, MK1 1PT, UK
Registration No: 1397386 (Wales)

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ