Sign Up
Log In
Log In
or
Sign Up
Places
All Projects
Status Monitor
Collapse sidebar
filesystems
lustre_2_12
0055-LU-16118-build-Workaround-__write_overflow...
Overview
Repositories
Revisions
Requests
Users
Attributes
Meta
File 0055-LU-16118-build-Workaround-__write_overflow_field-err.patch of Package lustre_2_12
From a3a51806ef361f55421a1bc07f64c78730ae50d5 Mon Sep 17 00:00:00 2001 From: Shaun Tancheff <shaun.tancheff@hpe.com> Date: Sun, 22 Jan 2023 11:43:29 -0600 Subject: [PATCH] LU-16118 build: Workaround __write_overflow_field errors MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Linux commit v5.17-rc3-1-gf68f2ff91512 fortify: Detect struct member overflows in memcpy() at compile-time memcpy and memset of collections of struct members will trigger: error: call to ‘__write_overflow_field’ declared with attribute warning: detected write beyond size of field (1st parameter); maybe use struct_group()? [-Werror] __write_overflow_field(p_size_field, size); Test-Parameters: trivial HPE-bug-id: LUS-11194 Signed-off-by: Shaun Tancheff <shaun.tancheff@hpe.com> Change-Id: Iacd1ab03d1b90ce62b5d7b65e1cd518a5f7981f2 Reviewed-on: https://review.whamcloud.com/c/fs/lustre-release/+/48364 Reviewed-by: Petros Koutoupis <petros.koutoupis@hpe.com> Reviewed-by: Oleg Drokin <green@whamcloud.com> Reviewed-by: jsimmons <jsimmons@infradead.org> Reviewed-by: Andreas Dilger <adilger@whamcloud.com> Reviewed-by: Neil Brown <neilb@suse.de> Tested-by: jenkins <devops@whamcloud.com> Tested-by: Maloo <maloo@whamcloud.com> --- libcfs/include/libcfs/linux/linux-misc.h | 11 +++++++++++ lustre/include/cl_object.h | 9 ++------- lustre/include/uapi/linux/lustre/lustre_idl.h | 4 ++++ lustre/obdclass/md_attrs.c | 3 +-- 4 files changed, 18 insertions(+), 9 deletions(-) --- a/libcfs/include/libcfs/linux/linux-misc.h +++ b/libcfs/include/libcfs/linux/linux-misc.h @@ -133,6 +133,17 @@ int cfs_get_environ(const char *key, cha int cfs_kernel_write(struct file *filp, const void *buf, size_t count, loff_t *pos); +#ifndef memset_startat +/** from linux 5.19 include/linux/string.h: */ +#define memset_startat(obj, v, member) \ +({ \ + u8 *__ptr = (u8 *)(obj); \ + typeof(v) __val = (v); \ + memset(__ptr + offsetof(typeof(*(obj)), member), __val, \ + sizeof(*(obj)) - offsetof(typeof(*(obj)), member)); \ +}) +#endif /* memset_startat() */ + /* * For RHEL6 struct kernel_parm_ops doesn't exist. Also * the arguments for .set and .get take different --- a/lustre/include/cl_object.h +++ b/lustre/include/cl_object.h @@ -99,6 +99,7 @@ #include <linux/spinlock.h> #include <linux/wait.h> #include <linux/pagevec.h> +#include <libcfs/linux/linux-misc.h> #include <lustre_dlm.h> struct obd_info; @@ -2396,13 +2397,7 @@ struct cl_io *cl_io_top(struct cl_io *io void cl_io_print(const struct lu_env *env, void *cookie, lu_printer_t printer, const struct cl_io *io); -#define CL_IO_SLICE_CLEAN(foo_io, base) \ -do { \ - typeof(foo_io) __foo_io = (foo_io); \ - \ - memset(&__foo_io->base, 0, \ - sizeof(*__foo_io) - offsetof(typeof(*__foo_io), base)); \ -} while (0) +#define CL_IO_SLICE_CLEAN(obj, base) memset_startat(obj, 0, base) /** @} cl_io */ --- a/lustre/include/uapi/linux/lustre/lustre_idl.h +++ b/lustre/include/uapi/linux/lustre/lustre_idl.h @@ -1470,6 +1470,10 @@ struct obd_quotactl { #define Q_COPY(out, in, member) (out)->member = (in)->member +/* NOTE: + * - in and out maybe a type of struct if_quotactl or struct obd_quotactl + * - in and out need not be of the same type. + */ #define QCTL_COPY(out, in) \ do { \ Q_COPY(out, in, qc_cmd); \ --- a/lustre/obdclass/md_attrs.c +++ b/lustre/obdclass/md_attrs.c @@ -73,8 +73,7 @@ void lustre_loa_init(struct lustre_ost_a { CLASSERT(sizeof(*loa) == LMA_OLD_SIZE); - memset(&loa->loa_parent_fid, 0, - sizeof(*loa) - offsetof(typeof(*loa), loa_parent_fid)); + memset_startat(loa, 0, loa_parent_fid); lustre_lma_init(&loa->loa_lma, fid, compat, incompat); } EXPORT_SYMBOL(lustre_loa_init);
Locations
Projects
Search
Status Monitor
Help
OpenBuildService.org
Documentation
API Documentation
Code of Conduct
Contact
Support
@OBShq
Terms
openSUSE Build Service is sponsored by
The Open Build Service is an
openSUSE project
.
Sign Up
Log In
Places
Places
All Projects
Status Monitor