]> git.ipfire.org Git - thirdparty/kernel/linux.git/commit
fs: Replace offsetof() with struct_size() in ioctl_file_dedupe_range()
authorXichao Zhao <zhao.xichao@vivo.com>
Fri, 29 Aug 2025 09:15:10 +0000 (17:15 +0800)
committerChristian Brauner <brauner@kernel.org>
Fri, 29 Aug 2025 10:00:58 +0000 (12:00 +0200)
commit38d1227fa71d96b470172df50e241775a802a8e7
tree2733573bbe7c7e7b6fd3b0759b80037cc1ee3b2c
parentec6f613ef376410753173f8236bad5f07a86503a
fs: Replace offsetof() with struct_size() in ioctl_file_dedupe_range()

When dealing with structures containing flexible arrays, struct_size()
provides additional compile-time checks compared to offsetof(). This
enhances code robustness and reduces the risk of potential errors.

Signed-off-by: Xichao Zhao <zhao.xichao@vivo.com>
Link: https://lore.kernel.org/20250829091510.597858-1-zhao.xichao@vivo.com
Reviewed-by: Jan Kara <jack@suse.cz>
Signed-off-by: Christian Brauner <brauner@kernel.org>
fs/ioctl.c