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

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

 



Hello David!

On 2020-01-07 19:01, David Sterba wrote:
It's not a runtime overhead but typecasts should not be needed in
general and when there's one it should be there for a reason. Sometimes
it's apparent and does not need a comment to explain why but otherwise I see it as "overhead" when reading the code. Lots of calculations done in
btrfs fit perfectly to 32bit, eg. the b-tree node or page-related ones.
Where it matters is eg. conversion from/to bio::bi_sector to/from btrfs
logical addresses that are u64, where the interface type is unsigned
long and not a fixed width.

Thanks for sharing that. As I said, I'm relatively new to btrfs internals.

The size constraints of the variables used in the reported expression
are known to developers so I tend to think the typecast is not
necessary.

Agreed.

Maybe the static checker tool could be improved to know the
invariants, that are eg. verified in fs/btrfs/disk-io.c:validate_super.

That's something that I will do some research on.

We can ignore this patch.

Thank you!

--
Cengiz Can
@cengiz_io



[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