Re: [PATCH net-next v6 3/6] net: devmem: prepare for autorelease rx token management

Dan Carpenter
2025-11-06T15:11:54Z

Hi Bobby,

kernel test robot noticed the following build warnings:

url: https://github.com/intel-lab-lkp/linux/commits/Bobby-Eshleman/net-devmem-rename-tx_vec-to-vec-in-dmabuf-binding/20251105-092703
base: 255d75ef029f33f75fcf5015052b7302486f7ad2
patch link: https://lore.kernel.org/r/20251104-scratch-bobbyeshleman-devmem-tcp-token-upstream-v6-3-ea98cf4d40b3%40meta.com
patch subject: [PATCH net-next v6 3/6] net: devmem: prepare for autorelease rx token management
config: openrisc-randconfig-r073-20251105 (https://download.01.org/0day-ci/archive/20251106/202511060119.MAzcsLoN-lkp@intel.com/config)
compiler: or1k-linux-gcc (GCC) 10.5.0

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>
| Reported-by: Dan Carpenter <dan.carpenter@linaro.org>
| Closes: https://lore.kernel.org/r/202511060119.MAzcsLoN-lkp@intel.com/

New smatch warnings:
net/core/sock.c:1107 sock_devmem_dontneed_manual_release() error: uninitialized symbol 'ret'.

vim +/ret +1107 net/core/sock.c

45aa39492cf4dd Bobby Eshleman 2025-11-04 1086 static noinline_for_stack int
45aa39492cf4dd Bobby Eshleman 2025-11-04 1087 sock_devmem_dontneed_manual_release(struct sock *sk, struct dmabuf_token *tokens,
45aa39492cf4dd Bobby Eshleman 2025-11-04 1088 unsigned int num_tokens)
45aa39492cf4dd Bobby Eshleman 2025-11-04 1089 {
45aa39492cf4dd Bobby Eshleman 2025-11-04 1090 struct net_iov *niov;
45aa39492cf4dd Bobby Eshleman 2025-11-04 1091 unsigned int i, j;
45aa39492cf4dd Bobby Eshleman 2025-11-04 1092 netmem_ref netmem;
45aa39492cf4dd Bobby Eshleman 2025-11-04 1093 unsigned int token;
45aa39492cf4dd Bobby Eshleman 2025-11-04 1094 int num_frags = 0;
45aa39492cf4dd Bobby Eshleman 2025-11-04 1095 int ret;

ret needs to be = 0;

45aa39492cf4dd Bobby Eshleman 2025-11-04 1096
45aa39492cf4dd Bobby Eshleman 2025-11-04 1097 if (!sk->sk_devmem_info.binding)
45aa39492cf4dd Bobby Eshleman 2025-11-04 1098 return -EINVAL;
45aa39492cf4dd Bobby Eshleman 2025-11-04 1099
45aa39492cf4dd Bobby Eshleman 2025-11-04 1100 for (i = 0; i < num_tokens; i++) {
45aa39492cf4dd Bobby Eshleman 2025-11-04 1101 for (j = 0; j < tokens[i].token_count; j++) {
45aa39492cf4dd Bobby Eshleman 2025-11-04 1102 token = tokens[i].token_start + j;
45aa39492cf4dd Bobby Eshleman 2025-11-04 1103 if (token >= sk->sk_devmem_info.binding->dmabuf->size / PAGE_SIZE)
45aa39492cf4dd Bobby Eshleman 2025-11-04 1104 break;
45aa39492cf4dd Bobby Eshleman 2025-11-04 1105
45aa39492cf4dd Bobby Eshleman 2025-11-04 1106 if (++num_frags > MAX_DONTNEED_FRAGS)
45aa39492cf4dd Bobby Eshleman 2025-11-04 @1107 return ret;

Uninitialized. It's always a good idea to test code with
CONFIG_INIT_STACK_ALL_PATTERN.

45aa39492cf4dd Bobby Eshleman 2025-11-04 1108
45aa39492cf4dd Bobby Eshleman 2025-11-04 1109 niov = sk->sk_devmem_info.binding->vec[token];
45aa39492cf4dd Bobby Eshleman 2025-11-04 1110 if (atomic_dec_and_test(&niov->uref)) {
45aa39492cf4dd Bobby Eshleman 2025-11-04 1111 netmem = net_iov_to_netmem(niov);
45aa39492cf4dd Bobby Eshleman 2025-11-04 1112 WARN_ON_ONCE(!napi_pp_put_page(netmem));
45aa39492cf4dd Bobby Eshleman 2025-11-04 1113 }
45aa39492cf4dd Bobby Eshleman 2025-11-04 1114 ret++;

Uninitialized.

45aa39492cf4dd Bobby Eshleman 2025-11-04 1115 }
45aa39492cf4dd Bobby Eshleman 2025-11-04 1116 }
45aa39492cf4dd Bobby Eshleman 2025-11-04 1117
45aa39492cf4dd Bobby Eshleman 2025-11-04 1118 atomic_sub(ret, &sk->sk_devmem_info.outstanding_urefs);
45aa39492cf4dd Bobby Eshleman 2025-11-04 1119
45aa39492cf4dd Bobby Eshleman 2025-11-04 1120 return ret;
45aa39492cf4dd Bobby Eshleman 2025-11-04 1121 }

--
0-DAY CI Kernel Test Service