diff options
author | Kees Cook <keescook@chromium.org> | 2023-05-12 14:22:12 -0700 |
---|---|---|
committer | Kees Cook <keescook@chromium.org> | 2023-05-30 16:41:52 -0700 |
commit | 2f088dfc1878108748018af0d2e3748ba9eee1e9 (patch) | |
tree | b8bca628f76deb84c5e84e6c369c023d4a70ba38 /drivers/md/raid5.h | |
parent | overflow: Add struct_size_t() helper (diff) | |
download | wireguard-linux-2f088dfc1878108748018af0d2e3748ba9eee1e9.tar.xz wireguard-linux-2f088dfc1878108748018af0d2e3748ba9eee1e9.zip |
md/raid5: Convert stripe_head's "dev" to flexible array member
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: Song Liu <song@kernel.org>
Cc: linux-raid@vger.kernel.org
Reviewed-by: Christoph Hellwig <hch@lst.de>
Acked-by: Song Liu <song@kernel.org>
Signed-off-by: Kees Cook <keescook@chromium.org>
Link: https://lore.kernel.org/lkml/20230522212114.gonna.589-kees@kernel.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?
Diffstat (limited to 'drivers/md/raid5.h')
-rw-r--r-- | drivers/md/raid5.h | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/drivers/md/raid5.h b/drivers/md/raid5.h index e873938a6125..6a92fafb0748 100644 --- a/drivers/md/raid5.h +++ b/drivers/md/raid5.h @@ -268,7 +268,7 @@ struct stripe_head { unsigned long flags; u32 log_checksum; unsigned short write_hint; - } dev[1]; /* allocated with extra space depending of RAID geometry */ + } dev[]; /* allocated depending of RAID geometry ("disks" member) */ }; /* stripe_head_state - collects and tracks the dynamic state of a stripe_head |