From: Kees Cook <keescook@chromium.org>
To: Song Liu <song@kernel.org>
Cc: Christoph Hellwig <hch@infradead.org>,
linux-raid@vger.kernel.org, linux-kernel@vger.kernel.org,
linux-hardening@vger.kernel.org
Subject: Re: [PATCH v2] md/raid5: Convert stripe_head's "dev" to flexible array member
Date: Tue, 30 May 2023 16:00:50 -0700 [thread overview]
Message-ID: <202305301600.EEF0BAAD@keescook> (raw)
In-Reply-To: <CAPhsuW5ibONdyyJq0zVCEHuM38GUocn8A1abi4mTa9gUHH1hHQ@mail.gmail.com>
On Tue, May 23, 2023 at 10:43:52AM -0700, Song Liu wrote:
> 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!
Thanks!
> I will hold this for a while until struct_size_t() merged.
Since my tree will introduce struct_size_t(), I will just carry it
there.
--
Kees Cook
next prev parent reply other threads:[~2023-05-30 23:00 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-05-22 21:21 [PATCH v2] md/raid5: Convert stripe_head's "dev" to flexible array member Kees Cook
2023-05-23 5:55 ` Christoph Hellwig
2023-05-23 17:43 ` Song Liu
2023-05-30 23:00 ` Kees Cook [this message]
2023-05-30 23:39 ` Song Liu
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=202305301600.EEF0BAAD@keescook \
--to=keescook@chromium.org \
--cc=hch@infradead.org \
--cc=linux-hardening@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-raid@vger.kernel.org \
--cc=song@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).