From: Jes Sorensen <jes.sorensen@gmail.com>
To: "Gustavo A. R. Silva" <gustavo@embeddedor.com>,
Kalle Valo <kvalo@codeaurora.org>
Cc: Joe Perches <joe@perches.com>,
Ulrich Kunitz <kune@deine-taler.de>,
"David S. Miller" <davem@davemloft.net>,
linux-wireless@vger.kernel.org, netdev@vger.kernel.org,
linux-kernel@vger.kernel.org, Kees Cook <keescook@chromium.org>
Subject: Re: [PATCH][next] zd1211rw/zd_usb.h: Replace zero-length array with flexible-array member
Date: Tue, 10 Mar 2020 18:34:31 -0400 [thread overview]
Message-ID: <9700b2c9-1029-60b0-c5d2-684bdcede354@gmail.com> (raw)
In-Reply-To: <e4cfda6c-37f0-3c28-f50b-32200a67d856@embeddedor.com>
On 3/10/20 6:31 PM, Gustavo A. R. Silva wrote:
>
>
> On 3/10/20 5:20 PM, Jes Sorensen wrote:
>> On 3/10/20 6:13 PM, Gustavo A. R. Silva wrote:
>>>
>>>
>>> On 3/10/20 5:07 PM, Jes Sorensen wrote:
>>>> As I stated in my previous answer, this seems more code churn than an
>>>> actual fix. If this is a real problem, shouldn't the work be put into
>>>> fixing the compiler to handle foo[0] instead? It seems that is where the
>>>> real value would be.
>>>
>>> Yeah. But, unfortunately, I'm not a compiler guy, so I'm not able to fix the
>>> compiler as you suggest. And I honestly don't see what is so annoying/disturbing
>>> about applying a patch that removes the 0 from foo[0] when it brings benefit
>>> to the whole codebase.
>>
>> My point is that it adds what seems like unnecessary churn, which is not
>> a benefit, and it doesn't improve the generated code.
>>
>
> As an example of one of the benefits of this is that the compiler won't trigger
> a warning in the following case:
>
> struct boo {
> int stuff;
> struct foo array[0];
> int morestuff;
> };
>
> The result of the code above is an undefined behavior.
>
> On the other hand in the case below, the compiles does trigger a warning:
>
> struct boo {
> int stuff;
> struct foo array[];
> int morestuff;
> };
Right, this just underlines my prior argument, that this should be fixed
in the compiler.
Jes
next prev parent reply other threads:[~2020-03-10 22:34 UTC|newest]
Thread overview: 22+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-03-05 11:12 Gustavo A. R. Silva
2020-03-05 14:50 ` Kalle Valo
2020-03-05 15:20 ` Joe Perches
2020-03-05 16:10 ` Kalle Valo
2020-03-05 18:28 ` Gustavo A. R. Silva
2020-03-10 13:56 ` Kalle Valo
2020-03-10 21:52 ` Gustavo A. R. Silva
2020-03-10 22:07 ` Jes Sorensen
2020-03-10 22:13 ` Gustavo A. R. Silva
2020-03-10 22:15 ` Joe Perches
2020-03-10 22:21 ` Gustavo A. R. Silva
2020-03-10 22:28 ` Joe Perches
2020-03-10 22:33 ` Jes Sorensen
2020-03-10 22:41 ` Joe Perches
2020-03-10 22:46 ` Gustavo A. R. Silva
2020-03-10 22:33 ` Gustavo A. R. Silva
2020-03-10 22:20 ` Jes Sorensen
2020-03-10 22:31 ` Gustavo A. R. Silva
2020-03-10 22:34 ` Jes Sorensen [this message]
2020-03-10 22:36 ` Gustavo A. R. Silva
2020-03-23 16:46 ` Kalle Valo
2020-03-23 17:14 ` [PATCH][next] zd1211rw: " Kalle Valo
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=9700b2c9-1029-60b0-c5d2-684bdcede354@gmail.com \
--to=jes.sorensen@gmail.com \
--cc=davem@davemloft.net \
--cc=gustavo@embeddedor.com \
--cc=joe@perches.com \
--cc=keescook@chromium.org \
--cc=kune@deine-taler.de \
--cc=kvalo@codeaurora.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-wireless@vger.kernel.org \
--cc=netdev@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
Powered by JetHome