All of lore.kernel.org
 help / color / mirror / Atom feed
* [bytedance:5.15-velinux 0/92] net/bpf/bpf_dummy_struct_ops.c:36:11: warning: default initialization of an object of type 'typeof ((kattr->test.ctx_in))' (aka 'const unsigned long long') leaves the object uninitialized
@ 2025-07-29 10:34 kernel test robot
  0 siblings, 0 replies; only message in thread
From: kernel test robot @ 2025-07-29 10:34 UTC (permalink / raw)
  To: jason.zeng; +Cc: oe-kbuild-all

tree:   https://github.com/bytedance/kernel.git 5.15-velinux
head:   c71e88ad12bfbc44f855b681ef923e1acc2e984a
commit: 4f78bb6527470bdf3309b62e7767279657a265c0 [0/92] bpf: Add dummy BPF STRUCT_OPS for test purpose
config: x86_64-rhel-9.4-rust (https://download.01.org/0day-ci/archive/20250729/202507291249.2TD46HJE-lkp@intel.com/config)
compiler: clang version 21.0.0git (https://github.com/llvm/llvm-project 61529d9e36fa86782a2458e6bdeedf7f376ef4b5)
rustc: rustc 1.58.0 (02072b482 2022-01-11)
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20250729/202507291249.2TD46HJE-lkp@intel.com/reproduce)

If you fix the issue in a separate patch/commit (i.e. not just a new version of
the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <lkp@intel.com>
| Closes: https://lore.kernel.org/oe-kbuild-all/202507291249.2TD46HJE-lkp@intel.com/

All warnings (new ones prefixed by >>):

>> net/bpf/bpf_dummy_struct_ops.c:36:11: warning: default initialization of an object of type 'typeof ((kattr->test.ctx_in))' (aka 'const unsigned long long') leaves the object uninitialized [-Wdefault-const-init-var-unsafe]
      36 |         ctx_in = u64_to_user_ptr(kattr->test.ctx_in);
         |                  ^
   include/linux/kernel.h:50:2: note: expanded from macro 'u64_to_user_ptr'
      50 |         typecheck(u64, (x));            \
         |         ^
   include/linux/typecheck.h:11:12: note: expanded from macro 'typecheck'
      11 |         typeof(x) __dummy2; \
         |                   ^
   1 warning generated.


vim +36 net/bpf/bpf_dummy_struct_ops.c

    19	
    20	static struct bpf_dummy_ops_test_args *
    21	dummy_ops_init_args(const union bpf_attr *kattr, unsigned int nr)
    22	{
    23		__u32 size_in;
    24		struct bpf_dummy_ops_test_args *args;
    25		void __user *ctx_in;
    26		void __user *u_state;
    27	
    28		size_in = kattr->test.ctx_size_in;
    29		if (size_in != sizeof(u64) * nr)
    30			return ERR_PTR(-EINVAL);
    31	
    32		args = kzalloc(sizeof(*args), GFP_KERNEL);
    33		if (!args)
    34			return ERR_PTR(-ENOMEM);
    35	
  > 36		ctx_in = u64_to_user_ptr(kattr->test.ctx_in);
    37		if (copy_from_user(args->args, ctx_in, size_in))
    38			goto out;
    39	
    40		/* args[0] is 0 means state argument of test_N will be NULL */
    41		u_state = u64_to_user_ptr(args->args[0]);
    42		if (u_state && copy_from_user(&args->state, u_state,
    43					      sizeof(args->state)))
    44			goto out;
    45	
    46		return args;
    47	out:
    48		kfree(args);
    49		return ERR_PTR(-EFAULT);
    50	}
    51	

-- 
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2025-07-29 10:34 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-07-29 10:34 [bytedance:5.15-velinux 0/92] net/bpf/bpf_dummy_struct_ops.c:36:11: warning: default initialization of an object of type 'typeof ((kattr->test.ctx_in))' (aka 'const unsigned long long') leaves the object uninitialized kernel test robot

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.