lkml.org 
[lkml]   [2023]   [May]   [23]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
From
Date
SubjectRe: [PATCH v2] md/raid5: Convert stripe_head's "dev" to flexible array member
On Mon, May 22, 2023 at 2:21 PM Kees Cook <keescook@chromium.org> wrote:
>
> Replace old-style 1-element array of "dev" in struct stripe_head with
> modern C99 flexible array. In the future, we can additionally annotate
> it with the run-time size, found in the "disks" member.
>
> Cc: Christoph Hellwig <hch@infradead.org>
> Cc: linux-raid@vger.kernel.org
> Signed-off-by: Kees Cook <keescook@chromium.org>
> ---
> It looks like this memory calculation:
>
> memory = conf->min_nr_stripes * (sizeof(struct stripe_head) +
> max_disks * ((sizeof(struct bio) + PAGE_SIZE))) / 1024;
>
> ... was already buggy (i.e. it included the single "dev" bytes in the
> result). However, I'm not entirely sure if that is the right analysis,
> since "dev" is not related to struct bio nor PAGE_SIZE?
>
> v1: https://lore.kernel.org/all/20230517233313.never.130-kees@kernel.org/
> v2: use new struct_size_t() helper from
> https://lore.kernel.org/lkml/20230522211810.never.421-kees@kernel.org/

LTGM. Thanks!

I will hold this for a while until struct_size_t() merged.

Song

\
 
 \ /
  Last update: 2023-05-23 19:44    [W:0.074 / U:0.032 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site