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]
Date:   Thu, 01 Oct 2020 11:21:22 +0200
From:   Stefan Agner <stefan@...er.ch>
To:     Miquel Raynal <miquel.raynal@...tlin.com>
Cc:     Jann Horn <jannh@...gle.com>,
        "Gustavo A. R. Silva" <gustavoars@...nel.org>,
        Lucas Stach <dev@...xeye.de>,
        Richard Weinberger <richard@....at>,
        Vignesh Raghavendra <vigneshr@...com>,
        Thierry Reding <thierry.reding@...il.com>,
        Jonathan Hunter <jonathanh@...dia.com>,
        linux-mtd@...ts.infradead.org, linux-tegra@...r.kernel.org,
        kernel list <linux-kernel@...r.kernel.org>,
        linux-hardening@...r.kernel.org
Subject: Re: [PATCH][next] mtd: rawnand: Replace one-element array with
 flexible-array member

On 2020-10-01 10:12, Miquel Raynal wrote:
> Hi Jann,
> 
> Jann Horn <jannh@...gle.com> wrote on Thu, 1 Oct 2020 00:32:24 +0200:
> 
>> On Wed, Sep 30, 2020 at 11:30 PM Gustavo A. R. Silva
>> <gustavoars@...nel.org> wrote:
>> > On Wed, Sep 30, 2020 at 11:10:43PM +0200, Jann Horn wrote:
>> > > On Wed, Sep 30, 2020 at 11:02 PM Gustavo A. R. Silva
>> > > <gustavoars@...nel.org> wrote:
>> > > > There is a regular need in the kernel to provide a way to declare having
>> > > > a dynamically sized set of trailing elements in a structure. Kernel code
>> > > > should always use “flexible array members”[1] for these cases. The older
>> > > > style of one-element or zero-length arrays should no longer be used[2].
>> > >
>> > > But this is not such a case, right? Isn't this a true fixed-size
>> > > array? It sounds like you're just changing it because it
>> > > pattern-matched on "array of length 1 at the end of a struct".
>> >
>> > Yeah; I should have changed that 'dynamically' part of the text above
>> > a bit. However, as I commented in the text below, in the case that more
>> > CS IDs are needed (let's wait for the maintainers to comment on this...)
>> > in the future, this change makes the code more maintainable, as for
>> > the allocation part, the developer would only have to update the CS_N
>> > macro to the number of CS IDs that are needed.
>>
>> But in that case, shouldn't you change it to "int cs[CS_N]" and get
>> rid of the struct_size() stuff?
> 
> I do agree with Jann, I think it's best to consider this a fixed-size
> array for now. If we ever want to extend the number of supported CS,
> there is much more rework involved anyway.

I agree, too, just assume this is a fixed-size array of 1 element.

In fact, I am not aware of a design which needs multiple chip selects.

--
Stefan

Powered by blists - more mailing lists