[openeuler:openEuler-1.0-LTS 1582/1582] include/linux/thread_info.h:119:17: warning: 'usercmd' may be used uninitialized

tree: https://gitee.com/openeuler/kernel.git openEuler-1.0-LTS head: d47443532b562cff105f8cfbc32343f83a2ecd01 commit: 71e217e85c3dff8a9151707ed3afc7b4b054a2d4 [1582/1582] selinux: use kernel linux/socket.h for genheaders and mdp config: x86_64-buildonly-randconfig-003-20250415 compiler: gcc-12 (Debian 12.2.0-14) 12.2.0 reproduce (this is a W=1 build): 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/202504160234.O5AhsCPF-lkp@intel.com/ Note: it may well be a FALSE warning. FWIW you are at least aware of it now. http://gcc.gnu.org/wiki/Better_Uninitialized_Warnings All warnings (new ones prefixed by >>): In file included from arch/x86/include/asm/preempt.h:7, from include/linux/preempt.h:81, from include/linux/spinlock.h:51, from include/linux/mmzone.h:9, from include/linux/gfp.h:6, from include/linux/slab.h:15, from include/linux/resource_ext.h:19, from include/linux/acpi.h:26, from include/linux/apple-gmux.h:21, from drivers/gpu/vga/vga_switcheroo.c:33: In function 'check_object_size', inlined from 'check_copy_size' at include/linux/thread_info.h:150:2, inlined from 'copy_from_user' at include/linux/uaccess.h:143:6, inlined from 'vga_switcheroo_debugfs_write' at drivers/gpu/vga/vga_switcheroo.c:795:6:
include/linux/thread_info.h:119:17: warning: 'usercmd' may be used uninitialized [-Wmaybe-uninitialized] 119 | __check_object_size(ptr, n, to_user); | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ include/linux/thread_info.h: In function 'vga_switcheroo_debugfs_write': include/linux/thread_info.h:112:13: note: by argument 1 of type 'const void *' to '__check_object_size' declared here 112 | extern void __check_object_size(const void *ptr, unsigned long n, | ^~~~~~~~~~~~~~~~~~~ drivers/gpu/vga/vga_switcheroo.c:785:14: note: 'usercmd' declared here 785 | char usercmd[64]; | ^~~~~~~ drivers/gpu/vga/vga_switcheroo.o: warning: objtool: check_can_switch()+0x8f: sibling call from callable instruction with modified stack frame drivers/gpu/vga/vga_switcheroo.o: warning: objtool: register_client()+0x2ef: sibling call from callable instruction with modified stack frame drivers/gpu/vga/vga_switcheroo.o: warning: objtool: vga_switcheroo_debugfs_write()+0x71e: sibling call from callable instruction with modified stack frame drivers/gpu/vga/vga_switcheroo.o: warning: objtool: vga_switcheroo_register_handler()+0x9a: sibling call from callable instruction with modified stack frame drivers/gpu/vga/vga_switcheroo.o: warning: objtool: vga_switcheroo_unregister_handler()+0x4d: sibling call from callable instruction with modified stack frame drivers/gpu/vga/vga_switcheroo.o: warning: objtool: vga_switcheroo_unregister_client()+0x234: sibling call from callable instruction with modified stack frame drivers/gpu/vga/vga_switcheroo.o: warning: objtool: vga_switcheroo_process_delayed_switch()+0x32: sibling call from callable instruction with modified stack frame drivers/gpu/vga/vga_switcheroo.o: warning: objtool: check_can_switch.cold()+0x0: call without frame pointer save/setup drivers/gpu/vga/vga_switcheroo.o: warning: objtool: register_client.cold()+0x0: call without frame pointer save/setup drivers/gpu/vga/vga_switcheroo.o: warning: objtool: vga_switcheroo_debugfs_write.cold()+0x0: call without frame pointer save/setup drivers/gpu/vga/vga_switcheroo.o: warning: objtool: vga_switcheroo_register_handler.cold()+0x0: call without frame pointer save/setup drivers/gpu/vga/vga_switcheroo.o: warning: objtool: vga_switcheroo_unregister_handler.cold()+0x0: call without frame pointer save/setup drivers/gpu/vga/vga_switcheroo.o: warning: objtool: vga_switcheroo_unregister_client.cold()+0x0: call without frame pointer save/setup drivers/gpu/vga/vga_switcheroo.o: warning: objtool: vga_switcheroo_process_delayed_switch.cold()+0x0: call without frame pointer save/setup
vim +/usercmd +119 include/linux/thread_info.h 0f60a8efe4005a Kees Cook 2016-07-12 110 f5509cc18daa7f Kees Cook 2016-06-07 111 #ifdef CONFIG_HARDENED_USERCOPY f5509cc18daa7f Kees Cook 2016-06-07 112 extern void __check_object_size(const void *ptr, unsigned long n, f5509cc18daa7f Kees Cook 2016-06-07 113 bool to_user); f5509cc18daa7f Kees Cook 2016-06-07 114 a85d6b8242dc78 Kees Cook 2016-09-07 115 static __always_inline void check_object_size(const void *ptr, unsigned long n, f5509cc18daa7f Kees Cook 2016-06-07 116 bool to_user) f5509cc18daa7f Kees Cook 2016-06-07 117 { 81409e9e280588 Kees Cook 2016-08-31 118 if (!__builtin_constant_p(n)) f5509cc18daa7f Kees Cook 2016-06-07 @119 __check_object_size(ptr, n, to_user); f5509cc18daa7f Kees Cook 2016-06-07 120 } f5509cc18daa7f Kees Cook 2016-06-07 121 #else f5509cc18daa7f Kees Cook 2016-06-07 122 static inline void check_object_size(const void *ptr, unsigned long n, f5509cc18daa7f Kees Cook 2016-06-07 123 bool to_user) f5509cc18daa7f Kees Cook 2016-06-07 124 { } f5509cc18daa7f Kees Cook 2016-06-07 125 #endif /* CONFIG_HARDENED_USERCOPY */ f5509cc18daa7f Kees Cook 2016-06-07 126 :::::: The code at line 119 was first introduced by commit :::::: f5509cc18daa7f82bcc553be70df2117c8eedc16 mm: Hardened usercopy :::::: TO: Kees Cook <keescook@chromium.org> :::::: CC: Kees Cook <keescook@chromium.org> -- 0-DAY CI Kernel Test Service https://github.com/intel/lkp-tests/wiki
participants (1)
-
kernel test robot