• L
    xfs: fix possible overflow in xfs_ioc_trim() · c029a50d
    Lukas Czerner 提交于
    In xfs_ioc_trim it is possible that computing the last allocation group
    to discard might overflow for big start & len values, because the result
    might be bigger then xfs_agnumber_t which is 32 bit long. Fix this by not
    allowing the start and end block of the range to be beyond the end of the
    file system.
    
    Note that if the start is beyond the end of the file system we have to
    return -EINVAL, but in the "end" case we have to truncate it to the fs
    size.
    
    Also introduce "end" variable, rather than using start+len which which
    might be more confusing to get right as this bug shows.
    Signed-off-by: NLukas Czerner <lczerner@redhat.com>
    Reviewed-by: NChristoph Hellwig <hch@lst.de>
    Signed-off-by: NAlex Elder <aelder@sgi.com>
    c029a50d
xfs_discard.c 5.8 KB