Hi Luigi,

kernel test robot noticed the following build warnings:

[auto build test WARNING on 50b70845fc5c22cf7e7d25b57d57b3dca1725aa5]

url:    
https://github.com/intel-lab-lkp/linux/commits/Luigi-Leonardi-via-B4-Relay/vsock-add-support-for-SIOCOUTQ-ioctl-for-all-vsock-socket-types/20240627-023902
base:   50b70845fc5c22cf7e7d25b57d57b3dca1725aa5
patch link:    
https://lore.kernel.org/r/20240626-ioctl_next-v3-1-63be5bf19a40%40outlook.com
patch subject: [PATCH net-next v3 1/3] vsock: add support for SIOCOUTQ ioctl 
for all vsock socket types.
config: i386-buildonly-randconfig-001-20240627 
(https://download.01.org/0day-ci/archive/20240627/202406271827.aq9zylch-...@intel.com/config)
compiler: clang version 18.1.5 (https://github.com/llvm/llvm-project 
617a15a9eac96088ae5e9134248d8236e34b91b1)
reproduce (this is a W=1 build): 
(https://download.01.org/0day-ci/archive/20240627/202406271827.aq9zylch-...@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 <l...@intel.com>
| Closes: 
https://lore.kernel.org/oe-kbuild-all/202406271827.aq9zylch-...@intel.com/

All warnings (new ones prefixed by >>):

>> net/vmw_vsock/af_vsock.c:1314:7: warning: variable 'retval' is used 
>> uninitialized whenever 'if' condition is false [-Wsometimes-uninitialized]
    1314 |                 if (vsk->transport->unsent_bytes) {
         |                     ^~~~~~~~~~~~~~~~~~~~~~~~~~~~
   net/vmw_vsock/af_vsock.c:1334:9: note: uninitialized use occurs here
    1334 |         return retval;
         |                ^~~~~~
   net/vmw_vsock/af_vsock.c:1314:3: note: remove the 'if' if its condition is 
always true
    1314 |                 if (vsk->transport->unsent_bytes) {
         |                 ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   net/vmw_vsock/af_vsock.c:1301:12: note: initialize the variable 'retval' to 
silence this warning
    1301 |         int retval;
         |                   ^
         |                    = 0
   1 warning generated.


vim +1314 net/vmw_vsock/af_vsock.c

  1295  
  1296  static int vsock_do_ioctl(struct socket *sock, unsigned int cmd,
  1297                            int __user *arg)
  1298  {
  1299          struct sock *sk = sock->sk;
  1300          struct vsock_sock *vsk;
  1301          int retval;
  1302  
  1303          vsk = vsock_sk(sk);
  1304  
  1305          switch (cmd) {
  1306          case SIOCOUTQ: {
  1307                  size_t n_bytes;
  1308  
  1309                  if (!vsk->transport || !vsk->transport->unsent_bytes) {
  1310                          retval = -EOPNOTSUPP;
  1311                          break;
  1312                  }
  1313  
> 1314                  if (vsk->transport->unsent_bytes) {
  1315                          if (sock_type_connectible(sk->sk_type) && 
sk->sk_state == TCP_LISTEN) {
  1316                                  retval = -EINVAL;
  1317                                  break;
  1318                          }
  1319  
  1320                          n_bytes = vsk->transport->unsent_bytes(vsk);
  1321                          if (n_bytes < 0) {
  1322                                  retval = n_bytes;
  1323                                  break;
  1324                          }
  1325  
  1326                          retval = put_user(n_bytes, arg);
  1327                  }
  1328                  break;
  1329          }
  1330          default:
  1331                  retval = -ENOIOCTLCMD;
  1332          }
  1333  
  1334          return retval;
  1335  }
  1336  

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

Reply via email to