Re: [PATCH] btrfs: fix integer overflow in calc_reclaim_items_nr

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Fri, Jun 23, 2017 at 05:29:56PM +0200, Holger Hoffstätte wrote:
> On 06/23/17 16:32, Chris Mason wrote:
> [..]
> > -static inline int calc_reclaim_items_nr(struct btrfs_fs_info *fs_info,
> > +static inline u64 calc_reclaim_items_nr(struct btrfs_fs_info *fs_info,
> >  					u64 to_reclaim)
> >  {
> >  	u64 bytes;
> > -	int nr;
> > +	u64 nr;
> >  
> >  	bytes = btrfs_calc_trans_metadata_size(fs_info, 1);
> >  	nr = (int)div64_u64(to_reclaim, bytes);
>         ^^^^^^^^^^
> 
> Isn't this a bit odd? I can't even tell whether it matters, just randomly
> noticed it because I genuinely dislike type casts..

I think the typecast shold be dropped, now that nr is u64.
--
To unsubscribe from this list: send the line "unsubscribe linux-btrfs" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html




[Index of Archives]     [Linux Filesystem Development]     [Linux NFS]     [Linux NILFS]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux