[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20200402195324.GB8077@duo.ucw.cz>
Date: Thu, 2 Apr 2020 21:53:24 +0200
From: Pavel Machek <pavel@...x.de>
To: Greg Kroah-Hartman <gregkh@...uxfoundation.org>
Cc: Pavel Machek <pavel@...x.de>, linux-kernel@...r.kernel.org,
stable@...r.kernel.org,
Maciej Żenczykowski <maze@...gle.com>,
John Stultz <john.stultz@...aro.org>,
Alexander Potapenko <glider@...gle.com>,
Alistair Delva <adelva@...gle.com>,
Daniel Borkmann <daniel@...earbox.net>,
Yonghong Song <yhs@...com>
Subject: Re: [PATCH 4.19 105/116] bpf: Explicitly memset the bpf_attr
structure
Hi!
> > Should we fix gcc, instead?
>
> Also, this is allowed in the C standard, and both clang and gcc
> sometimes emit code that does not clear padding in structures. Changing
> the compiler to not do this would be wonderful, but we still have to
> live with this for the next 10 years as those older compilers age-out.
I agree C standard allows this. It allows to even worse stuff.
I was just surprised that gcc does that.. and that I did not know
about this trap. I was probably telling people to do = {} for
structure init...
Should we get "= {}" warning for checkpatch?
Is it fair to replace "= {}" with memset() as soon as it is returned
to userland, without testing that gcc "miscompiles" this particular
example?
Best regards,
Pavel
--
DENX Software Engineering GmbH, Managing Director: Wolfgang Denk
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Download attachment "signature.asc" of type "application/pgp-signature" (196 bytes)
Powered by blists - more mailing lists