Re: [PATCH] FS: ext4: fix integer overflow in alloc_flex_gd()
From: Eric Sandeen <hidden>
Date: 2012-02-21 16:37:02
Also in:
lkml
On 02/21/2012 07:55 AM, Xi Wang wrote:
On Feb 20, 2012, at 6:47 PM, Eric Sandeen wrote:quoted
Hm this raises a few questions I think. On the one hand, making sure the kmalloc arg doesn't overflow here is certainly a good thing and probably the right thing to do in the short term. So I guess: Reviewed-by: Eric Sandeen <redacted> for that, to close the hole.Another possibility is to wait for knalloc/kmalloc_array in the -mm tree, which is basically the non-zeroing version of kcalloc that performs overflow checking.quoted
Doesn't this also mean that a valid s_log_groups_per_flex (i.e. 31) will fail in this resize code? That would be an unexpected outcome. 2^31 groups per flex is a little crazy, but still technically valid according to the limits in the code.Or we could limit s_log_groups_per_flex/groups_per_flex to a reasonable upper bound in ext4_fill_flex_info(), right?
Depends on the "flex_bg" design intent, I guess. I don't know if the 2^31 was an intended design limit, or just a mathematical limit that based on container sizes etc... I'd have to look at the resize code more carefully but I can't imagine that it's imperative to allocate this stuff all at once. -Eric
- xi