Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1705347 > unrolled thread
| Started by | Arnd Bergmann <arnd@arndb.de> |
|---|---|
| First post | 2017-08-07 13:00 +0200 |
| Last post | 2017-08-14 14:30 +0200 |
| Articles | 3 — 3 participants |
Back to article view | Back to linux.kernel
[PATCH] ext4: fix clang build regression Arnd Bergmann <arnd@arndb.de> - 2017-08-07 13:00 +0200
Re: [PATCH] ext4: fix clang build regression Chandan Rajendra <chandan@linux.vnet.ibm.com> - 2017-08-12 10:40 +0200
Re: [PATCH] ext4: fix clang build regression Theodore Ts'o <tytso@mit.edu> - 2017-08-14 14:30 +0200
| From | Arnd Bergmann <arnd@arndb.de> |
|---|---|
| Date | 2017-08-07 13:00 +0200 |
| Subject | [PATCH] ext4: fix clang build regression |
| Message-ID | <ubNVo-77X-9@gated-at.bofh.it> |
As Stefan pointed out, I misremembered what clang can do specifically,
and it turns out that the variable-length array at the end of the
structure did not work (a flexible array would have worked here
but not solved the problem):
fs/ext4/mballoc.c:2303:17: error: fields must have a constant size:
'variable length array in structure' extension will never be supported
ext4_grpblk_t counters[blocksize_bits + 2];
This reverts part of my previous patch, using a fixed-size array
again, but keeping the check for the array overflow.
Fixes: 2df2c3402fc8 ("ext4: fix warning about stack corruption")
Reported-by: Stefan Agner <stefan@agner.ch>
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
---
fs/ext4/mballoc.c | 7 +++++--
1 file changed, 5 insertions(+), 2 deletions(-)
diff --git a/fs/ext4/mballoc.c b/fs/ext4/mballoc.c
index 5a1052627a81..701085620cd8 100644
--- a/fs/ext4/mballoc.c
+++ b/fs/ext4/mballoc.c
@@ -2300,7 +2300,7 @@ static int ext4_mb_seq_groups_show(struct seq_file *seq, void *v)
EXT4_MAX_BLOCK_LOG_SIZE);
struct sg {
struct ext4_group_info info;
- ext4_grpblk_t counters[blocksize_bits + 2];
+ ext4_grpblk_t counters[EXT4_MAX_BLOCK_LOG_SIZE + 2];
} sg;
group--;
@@ -2309,6 +2309,9 @@ static int ext4_mb_seq_groups_show(struct seq_file *seq, void *v)
" 2^0 2^1 2^2 2^3 2^4 2^5 2^6 "
" 2^7 2^8 2^9 2^10 2^11 2^12 2^13 ]\n");
+ i = (blocksize_bits + 2) * sizeof(sg.info.bb_counters[0]) +
+ sizeof(struct ext4_group_info);
+
grinfo = ext4_get_group_info(sb, group);
/* Load the group info in memory only if not already loaded. */
if (unlikely(EXT4_MB_GRP_NEED_INIT(grinfo))) {
@@ -2320,7 +2323,7 @@ static int ext4_mb_seq_groups_show(struct seq_file *seq, void *v)
buddy_loaded = 1;
}
- memcpy(&sg, ext4_get_group_info(sb, group), sizeof(sg));
+ memcpy(&sg, ext4_get_group_info(sb, group), i);
if (buddy_loaded)
ext4_mb_unload_buddy(&e4b);
--
2.9.0
[toc] | [next] | [standalone]
| From | Chandan Rajendra <chandan@linux.vnet.ibm.com> |
|---|---|
| Date | 2017-08-12 10:40 +0200 |
| Message-ID | <udA7G-6G3-55@gated-at.bofh.it> |
| In reply to | #1705347 |
On Monday, August 7, 2017 4:26:51 PM IST Arnd Bergmann wrote:
> As Stefan pointed out, I misremembered what clang can do specifically,
> and it turns out that the variable-length array at the end of the
> structure did not work (a flexible array would have worked here
> but not solved the problem):
>
> fs/ext4/mballoc.c:2303:17: error: fields must have a constant size:
> 'variable length array in structure' extension will never be supported
> ext4_grpblk_t counters[blocksize_bits + 2];
>
> This reverts part of my previous patch, using a fixed-size array
> again, but keeping the check for the array overflow.
>
> Fixes: 2df2c3402fc8 ("ext4: fix warning about stack corruption")
> Reported-by: Stefan Agner <stefan@agner.ch>
> Signed-off-by: Arnd Bergmann <arnd@arndb.de>
I executed xfstests on a ppc64 machine with both 4k and 64k block size
combination.
Tested-by: Chandan Rajendra <chandan@linux.vnet.ibm.com>
--
chandan
[toc] | [prev] | [next] | [standalone]
| From | Theodore Ts'o <tytso@mit.edu> |
|---|---|
| Date | 2017-08-14 14:30 +0200 |
| Message-ID | <uemFk-45M-21@gated-at.bofh.it> |
| In reply to | #1710204 |
On Sat, Aug 12, 2017 at 02:09:29PM +0530, Chandan Rajendra wrote:
> On Monday, August 7, 2017 4:26:51 PM IST Arnd Bergmann wrote:
> > As Stefan pointed out, I misremembered what clang can do specifically,
> > and it turns out that the variable-length array at the end of the
> > structure did not work (a flexible array would have worked here
> > but not solved the problem):
> >
> > fs/ext4/mballoc.c:2303:17: error: fields must have a constant size:
> > 'variable length array in structure' extension will never be supported
> > ext4_grpblk_t counters[blocksize_bits + 2];
> >
> > This reverts part of my previous patch, using a fixed-size array
> > again, but keeping the check for the array overflow.
> >
> > Fixes: 2df2c3402fc8 ("ext4: fix warning about stack corruption")
> > Reported-by: Stefan Agner <stefan@agner.ch>
> > Signed-off-by: Arnd Bergmann <arnd@arndb.de>
>
> I executed xfstests on a ppc64 machine with both 4k and 64k block size
> combination.
>
> Tested-by: Chandan Rajendra <chandan@linux.vnet.ibm.com>
Thanks, applied.
- Ted
[toc] | [prev] | [standalone]
Back to top | Article view | linux.kernel
csiph-web