Re: [PATCH] jfs: Use unsigned variable for length calculations

Christian Brauner
2023-06-02T08:32:41Z

On Sat, 04 Feb 2023 10:33:56 -0800, Kees Cook wrote:
> To avoid confusing the compiler about possible negative sizes, switch
> "ssize" which can never be negative from int to u32. Seen with GCC 13:
>
> ../fs/jfs/namei.c: In function 'jfs_symlink': ../include/linux/fortify-string.h:57:33: warning: '__builtin_memcpy' pointer overflow between offset 0 and size [-2147483648, -1]
> [-Warray-bounds=]
> 57 | #define __underlying_memcpy __builtin_memcpy
> | ^
> ...
> ../fs/jfs/namei.c:950:17: note: in expansion of macro 'memcpy'
> 950 | memcpy(ip->i_link, name, ssize);
> | ^~~~~~
>
> [...]

Applied to the vfs.misc branch of the vfs/vfs.git tree.
Patches in the vfs.misc branch should appear in linux-next soon.

Please report any outstanding bugs that were missed during review in a
new review to the original patch series allowing us to drop it.

It's encouraged to provide Acked-bys and Reviewed-bys even though the
patch has now been applied. If possible patch trailers will be updated.

tree: https://git.kernel.org/pub/scm/linux/kernel/git/vfs/vfs.git
branch: vfs.misc

[1/1] jfs: Use unsigned variable for length calculations