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-randconfig-141-20240628 
(https://download.01.org/0day-ci/archive/20240628/202406281355.d1jnvgbc-...@intel.com/config)
compiler: gcc-8 (Ubuntu 8.4.0-3ubuntu2) 8.4.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 <l...@intel.com>
| Closes: 
https://lore.kernel.org/oe-kbuild-all/202406281355.d1jnvgbc-...@intel.com/

smatch warnings:
net/vmw_vsock/af_vsock.c:1321 vsock_do_ioctl() warn: unsigned 'n_bytes' is 
never less than zero.

vim +/n_bytes +1321 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