[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-ID: <202301100424.sL6nSNSL-lkp@intel.com>
Date: Tue, 10 Jan 2023 08:10:54 +0300
From: Dan Carpenter <error27@...il.com>
To: oe-kbuild@...ts.linux.dev, Maxim Mikityanskiy <maximmi@...dia.com>
Cc: lkp@...el.com, oe-kbuild-all@...ts.linux.dev,
linux-kernel@...r.kernel.org, Jakub Kicinski <kuba@...nel.org>,
Tariq Toukan <tariqt@...dia.com>,
Saeed Mahameed <saeedm@...dia.com>
Subject: drivers/net/ethernet/mellanox/mlx5/core/en/params.c:481
mlx5e_mpwrq_validate_xsk() error: we previously assumed 'xsk' could be null
(see line 478)
tree: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master
head: 1fe4fd6f5cad346e598593af36caeadc4f5d4fa9
commit: 6470d2e7e8ed8e9dd560d8dc3e09d1100a17ee26 net/mlx5e: xsk: Use KSM for unaligned XSK
config: i386-randconfig-m021-20230102
compiler: gcc-11 (Debian 11.3.0-8) 11.3.0
If you fix the issue, kindly add following tag where applicable
| Reported-by: kernel test robot <lkp@...el.com>
| Reported-by: Dan Carpenter <error27@...il.com>
New smatch warnings:
drivers/net/ethernet/mellanox/mlx5/core/en/params.c:481 mlx5e_mpwrq_validate_xsk() error: we previously assumed 'xsk' could be null (see line 478)
Old smatch warnings:
drivers/net/ethernet/mellanox/mlx5/core/en/params.c:314 mlx5e_mpwqe_get_log_num_strides() warn: signedness bug returning '(-255)'
vim +/xsk +481 drivers/net/ethernet/mellanox/mlx5/core/en/params.c
44f4fd03b51705 Maxim Mikityanskiy 2022-09-27 474 int mlx5e_mpwrq_validate_xsk(struct mlx5_core_dev *mdev, struct mlx5e_params *params,
44f4fd03b51705 Maxim Mikityanskiy 2022-09-27 475 struct mlx5e_xsk_param *xsk)
44f4fd03b51705 Maxim Mikityanskiy 2022-09-27 476 {
e5a3cc83d54019 Maxim Mikityanskiy 2022-09-29 477 u8 page_shift = mlx5e_mpwrq_page_shift(mdev, xsk);
6470d2e7e8ed8e Maxim Mikityanskiy 2022-09-29 @478 bool unaligned = xsk ? xsk->unaligned : false;
^^^
Assumes xsk can be NULL
e5a3cc83d54019 Maxim Mikityanskiy 2022-09-29 479 u16 max_mtu_pkts;
e5a3cc83d54019 Maxim Mikityanskiy 2022-09-29 480
6470d2e7e8ed8e Maxim Mikityanskiy 2022-09-29 @481 if (!mlx5e_check_fragmented_striding_rq_cap(mdev, page_shift, xsk->unaligned))
^^^^^
Unchecked dereference
44f4fd03b51705 Maxim Mikityanskiy 2022-09-27 482 return -EOPNOTSUPP;
44f4fd03b51705 Maxim Mikityanskiy 2022-09-27 483
44f4fd03b51705 Maxim Mikityanskiy 2022-09-27 484 if (!mlx5e_rx_mpwqe_is_linear_skb(mdev, params, xsk))
44f4fd03b51705 Maxim Mikityanskiy 2022-09-27 485 return -EINVAL;
44f4fd03b51705 Maxim Mikityanskiy 2022-09-27 486
e5a3cc83d54019 Maxim Mikityanskiy 2022-09-29 487 /* Current RQ length is too big for the given frame size, the
e5a3cc83d54019 Maxim Mikityanskiy 2022-09-29 488 * needed number of WQEs exceeds the maximum.
e5a3cc83d54019 Maxim Mikityanskiy 2022-09-29 489 */
e5a3cc83d54019 Maxim Mikityanskiy 2022-09-29 490 max_mtu_pkts = min_t(u8, MLX5E_PARAMS_MAXIMUM_LOG_RQ_SIZE,
6470d2e7e8ed8e Maxim Mikityanskiy 2022-09-29 491 mlx5e_mpwrq_max_log_rq_pkts(mdev, page_shift, unaligned));
e5a3cc83d54019 Maxim Mikityanskiy 2022-09-29 492 if (params->log_rq_mtu_frames > max_mtu_pkts) {
e5a3cc83d54019 Maxim Mikityanskiy 2022-09-29 493 mlx5_core_err(mdev, "Current RQ length %d is too big for XSK with given frame size %u\n",
e5a3cc83d54019 Maxim Mikityanskiy 2022-09-29 494 1 << params->log_rq_mtu_frames, xsk->chunk_size);
e5a3cc83d54019 Maxim Mikityanskiy 2022-09-29 495 return -EINVAL;
e5a3cc83d54019 Maxim Mikityanskiy 2022-09-29 496 }
e5a3cc83d54019 Maxim Mikityanskiy 2022-09-29 497
44f4fd03b51705 Maxim Mikityanskiy 2022-09-27 498 return 0;
b3a131c2a1602e Tariq Toukan 2021-03-07 499 }
--
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests
Powered by blists - more mailing lists