• L
    ext4: fix start and len arguments handling in ext4_trim_fs() · 913eed83
    Lukas Czerner 提交于
    The overflow can happen when we are calling get_group_no_and_offset()
    which stores the group number in the ext4_grpblk_t type which is
    actually int. However when the blocknr is big enough the group number
    might be bigger than ext4_grpblk_t resulting in overflow. This will
    most likely happen with FITRIM default argument len = ULLONG_MAX.
    
    Fix this by using "end" variable instead of "start+len" as it is easier
    to get right and specifically check that the end is not beyond the end
    of the file system, so we are sure that the result of
    get_group_no_and_offset() will not overflow. Otherwise truncate it to
    the size of the file system.
    Signed-off-by: NLukas Czerner <lczerner@redhat.com>
    Reviewed-by: NJan Kara <jack@suse.cz>
    Signed-off-by: N"Theodore Ts'o" <tytso@mit.edu>
    913eed83
mballoc.c 137.9 KB