[RFC PATCH] fs/hugetlb: Fix UBSAN warning reported on hugetlb
Aneesh Kumar K V
aneesh.kumar at linux.ibm.com
Fri Sep 9 02:59:59 AEST 2022
On 9/8/22 10:23 PM, Matthew Wilcox wrote:
> On Thu, Sep 08, 2022 at 12:56:59PM +0530, Aneesh Kumar K.V wrote:
>> +++ b/fs/dax.c
>> @@ -1304,7 +1304,7 @@ EXPORT_SYMBOL_GPL(dax_zero_range);
>> int dax_truncate_page(struct inode *inode, loff_t pos, bool *did_zero,
>> const struct iomap_ops *ops)
>> {
>> - unsigned int blocksize = i_blocksize(inode);
>> + size_t blocksize = i_blocksize(inode);
>> unsigned int off = pos & (blocksize - 1);
>
> If blocksize is larger than 4GB, then off also needs to be size_t.
>
>> +++ b/fs/iomap/buffered-io.c
>> @@ -955,7 +955,7 @@ int
>> iomap_truncate_page(struct inode *inode, loff_t pos, bool *did_zero,
>> const struct iomap_ops *ops)
>> {
>> - unsigned int blocksize = i_blocksize(inode);
>> + size_t blocksize = i_blocksize(inode);
>> unsigned int off = pos & (blocksize - 1);
>
> Ditto.
>
> (maybe there are others; I didn't check closely)
Thanks. will check those.
Any feedback on statx? Should we really fix that?
I am still not clear why we chose to set blocksize = pagesize for hugetlbfs.
Was that done to enable application find the hugetlb pagesize via stat()?
-aneesh
More information about the Linuxppc-dev
mailing list