Re: [PATCH 1/1] xfs: check for possible overflow in xfs_ioc_trim

2012-07-31 Thread Tomas Racek
> > + > > + if (range.start > ULLONG_MAX - BBSIZE) > > + return -XFS_ERROR(EINVAL); > > + > > There's no point checking for overflow on the range start - what we > need to check is whether it is larger than the size of the > filesystem. We do that after the conversion of range.start to

Re: [PATCH 1/1] xfs: check for possible overflow in xfs_ioc_trim

2012-07-30 Thread Dave Chinner
On Mon, Jul 30, 2012 at 10:13:44AM +0200, Tomas Racek wrote: > If range.start argument was between ULLONG_MAX - BBSIZE and ULLONG_MAX, > BTOBB macro resulted in overflow which caused start to be set to 0. > Now, invalid argument error is returned instead. > > Signed-off-by: Tomas Racek > --- > f

[PATCH 1/1] xfs: check for possible overflow in xfs_ioc_trim

2012-07-30 Thread Tomas Racek
If range.start argument was between ULLONG_MAX - BBSIZE and ULLONG_MAX, BTOBB macro resulted in overflow which caused start to be set to 0. Now, invalid argument error is returned instead. Signed-off-by: Tomas Racek --- fs/xfs/xfs_discard.c |4 1 files changed, 4 insertions(+), 0 deleti