driverdev-devel.linuxdriverproject.org archive mirror
 help / color / mirror / Atom feed
From: David Laight <David.Laight@ACULAB.COM>
To: 'Dan Carpenter' <dan.carpenter@oracle.com>,
	Denis Efremov <efremov@linux.com>
Cc: "devel@driverdev.osuosl.org" <devel@driverdev.osuosl.org>,
	Jes Sorensen <jes.sorensen@gmail.com>,
	Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
	"stable@vger.kernel.org" <stable@vger.kernel.org>,
	Hans de Goede <hdegoede@redhat.com>,
	Bastien Nocera <hadess@hadess.net>,
	Dmitry Vyukov <dvyukov@google.com>,
	Larry Finger <Larry.Finger@lwfinger.net>
Subject: RE: [PATCH] staging: rtl8723bs: hal: Fix memcpy calls
Date: Tue, 1 Oct 2019 14:36:09 +0000	[thread overview]
Message-ID: <8d2e8196cae74ec4ae20e9c23e898207@AcuMS.aculab.com> (raw)
In-Reply-To: <20191001135649.GH22609@kadam>

> From: Dan Carpenter
> Sent: 01 October 2019 14:57
> Subject: Re: [PATCH] staging: rtl8723bs: hal: Fix memcpy calls
...
> That's true for glibc memcpy() but not for the kernel memcpy().  In the
> kernel there are lots of places which do a zero size memcpy().

And probably from NULL (or even garbage) pointers.

After all a pointer to the end of an array (a + ARRAY_SIZE(a)) is valid
but must not be dereferenced - so memcpy() can't dereference it's
source address when the length is zero.

> The glibc attitude is "the standard allows us to put knives here" so
> let's put knives everywhere in the path.  And the GCC attitude is let's
> silently remove NULL checks instead of just printing a warning that the
> NULL check isn't required...  It could really make someone despondent.

gcc is the one that add knives...

This reminds me of me of a compiler that decided to optimise away
checks for function addresses being NULL.
At almost exactly the same time that ELF allowed for undefined weak symbols.
Checking whether a function was actually present was non-trivial.

	David

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

_______________________________________________
devel mailing list
devel@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel

  reply	other threads:[~2019-10-01 14:36 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-09-30 11:01 [PATCH] staging: rtl8723bs: hal: Fix memcpy calls Denis Efremov
2019-09-30 13:18 ` David Laight
2019-09-30 14:25   ` Denis Efremov
2019-10-01 13:56     ` Dan Carpenter
2019-10-01 14:36       ` David Laight [this message]
2019-10-01 15:13         ` Denis Efremov
2019-10-01 16:00           ` David Laight
2019-10-01 18:58           ` Dan Carpenter
2019-10-01 20:15             ` Denis Efremov
2019-10-09 14:38             ` Dan Carpenter
2019-09-30 15:40   ` Denis Efremov
2019-09-30 13:39 ` Sasha Levin
2019-10-09  9:35 ` Hans de Goede
2019-10-09 10:43   ` Denis Efremov

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=8d2e8196cae74ec4ae20e9c23e898207@AcuMS.aculab.com \
    --to=david.laight@aculab.com \
    --cc=Larry.Finger@lwfinger.net \
    --cc=dan.carpenter@oracle.com \
    --cc=devel@driverdev.osuosl.org \
    --cc=dvyukov@google.com \
    --cc=efremov@linux.com \
    --cc=gregkh@linuxfoundation.org \
    --cc=hadess@hadess.net \
    --cc=hdegoede@redhat.com \
    --cc=jes.sorensen@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=stable@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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).