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

From: Gao Xiang
Date: Tue Jan 09 2024 - 08:09:36 EST




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@xxxxxxxxxx>
Reported-by: kernel test robot <lkp@xxxxxxxxx>
Closes: https://lore.kernel.org/oe-kbuild-all/202401071152.DbKqMQMu-lkp@xxxxxxxxx/
Signed-off-by: David Howells <dhowells@xxxxxxxxxx>
Reviewed-by: Simon Horman <horms@xxxxxxxxxx>
cc: Gao Xiang <hsiangkao@xxxxxxxxxxxxxxxxx>
cc: Yiqun Leng <yqleng@xxxxxxxxxxxxxxxxx>
cc: Jia Zhu <zhujia.zj@xxxxxxxxxxxxx>
cc: Jeff Layton <jlayton@xxxxxxxxxx>
cc: linux-cachefs@xxxxxxxxxx
cc: linux-erofs@xxxxxxxxxxxxxxxx
cc: linux-fsdevel@xxxxxxxxxxxxxxx
cc: linux-mm@xxxxxxxxx

It looks good to me,
Reviewed-by: Gao Xiang <hsiangkao@xxxxxxxxxxxxxxxxx>

Thanks,
Gao Xiang