[PATCH 5/6] cachefiles: Fix signed/unsigned mixup

Gao Xiang hsiangkao at linux.alibaba.com
Wed Jan 10 00:03:39 AEDT 2024



On 2024/1/9 19:20, David Howells wrote:
> In __cachefiles_prepare_write(), the start and pos variables were made
> unsigned 64-bit so that the casts in the checking could be got rid of -
> which should be fine since absolute file offsets can't be negative, except
> that an error code may be obtained from vfs_llseek(), which *would* be
> negative.  This breaks the error check.
> 
> Fix this for now by reverting pos and start to be signed and putting back
> the casts.  Unfortunately, the error value checks cannot be replaced with
> IS_ERR_VALUE() as long might be 32-bits.
> 
> Fixes: 7097c96411d2 ("cachefiles: Fix __cachefiles_prepare_write()")
> Reported-by: Simon Horman <horms at kernel.org>
> Reported-by: kernel test robot <lkp at intel.com>
> Closes: https://lore.kernel.org/oe-kbuild-all/202401071152.DbKqMQMu-lkp@intel.com/
> Signed-off-by: David Howells <dhowells at redhat.com>
> Reviewed-by: Simon Horman <horms at kernel.org>
> cc: Gao Xiang <hsiangkao at linux.alibaba.com>
> cc: Yiqun Leng <yqleng at linux.alibaba.com>
> cc: Jia Zhu <zhujia.zj at bytedance.com>
> cc: Jeff Layton <jlayton at kernel.org>
> cc: linux-cachefs at redhat.com
> cc: linux-erofs at lists.ozlabs.org
> cc: linux-fsdevel at vger.kernel.org
> cc: linux-mm at kvack.org

It looks good to me,
Reviewed-by: Gao Xiang <hsiangkao at linux.alibaba.com>

Thanks,
Gao Xiang


More information about the Linux-erofs mailing list