lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Date:	Tue, 31 Jul 2012 06:32:34 -0400 (EDT)
From:	Tomas Racek <tracek@...hat.com>
To:	Dave Chinner <david@...morbit.com>
Cc:	Alex Elder <elder@...nel.org>,
	open list <linux-kernel@...r.kernel.org>,
	"supporter:XFS FILESYSTEM" <xfs@....sgi.com>,
	linux-xfs@...r.kernel.org, Ben Myers <bpm@....com>,
	lczerner@...hat.com
Subject: Re: [PATCH 1/1] xfs: check for possible overflow in xfs_ioc_trim

> > +
> > +	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 basic
> blocks, so that check needs to be promoted to before this. i.e.
> 
> 	if (range.start >= XFS_FSB_TO_B(mp, mp->m_sb.sb_dblocks))
> 		return -XFS_ERROR(EINVAL);
> 
> >  	start = BTOBB(range.start);
> >  	end = start + BTOBBT(range.len) - 1;
> >  	minlen = BTOBB(max_t(u64, granularity, range.minlen));
> 
> And that will prevent the overflow in BTOBB() just as effectively...

You're right, that's a far better way, I'll change it so.

Thanks!

Tomas
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ