Re: [PATCH] fs: btrfs: prevent unintentional int overflow

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

 



On January 6, 2020 18:53:40 David Sterba <dsterba@xxxxxxx> wrote:

The overflow can't happen in practice. Taking generous maximum value for
an item and sectorsize (64K) and doing the math will reach nowhere the
overflow limit for 32bit type:

64K / 4 * 64K = 1G

I didn't know that. Thanks for sharing.

I'm not sure if this is worth adding the cast, or mark the coverity
issue as not important.

If the cast is adding any overhead (which I don't think it does) I would kindly request adding it for the sake of completeness.

For example: if some newbie like me tries adding something, they would be warned that we should consider possible overflows and/or at least be careful with expressions that contain different sized integers.

If this sounds unnecessary, I will help with marking the Coverity issue as unimportant.

Thank you!






[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