lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-ID: <7e8141cb-44e6-477c-b77e-aa9b4bc5af3a@stanley.mountain>
Date: Mon, 16 Sep 2024 10:35:28 +0300
From: Dan Carpenter <dan.carpenter@...aro.org>
To: oe-kbuild@...ts.linux.dev, Srujana Challa <schalla@...vell.com>
Cc: lkp@...el.com, oe-kbuild-all@...ts.linux.dev,
	linux-kernel@...r.kernel.org, "Michael S. Tsirkin" <mst@...hat.com>,
	Vamsi Attunuru <vattunuru@...vell.com>,
	Shijith Thotton <sthotton@...vell.com>,
	Nithin Dabilpuram <ndabilpuram@...vell.com>
Subject: drivers/vdpa/octeon_ep/octep_vdpa_hw.c:143 octep_process_mbox()
 warn: missing error code? 'ret'

tree:   https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master
head:   98f7e32f20d28ec452afb208f9cffc08448a2652
commit: 8b6c724cdab85d8923dd8c474a5a9464228379c5 virtio: vdpa: vDPA driver for Marvell OCTEON DPU devices
date:   10 weeks ago
config: i386-randconfig-141-20240912 (https://download.01.org/0day-ci/archive/20240916/202409160431.bRhZWhiU-lkp@intel.com/config)
compiler: clang version 18.1.8 (https://github.com/llvm/llvm-project 3b5b5c1ec4a3095ab096dd780e84d7ab81f3d7ff)

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@...el.com>
| Reported-by: Dan Carpenter <dan.carpenter@...aro.org>
| Closes: https://lore.kernel.org/r/202409160431.bRhZWhiU-lkp@intel.com/

New smatch warnings:
drivers/vdpa/octeon_ep/octep_vdpa_hw.c:143 octep_process_mbox() warn: missing error code? 'ret'
drivers/vdpa/octeon_ep/octep_vdpa_hw.c:478 octep_hw_caps_read() warn: argument 3 to %016llx specifier is cast from pointer

Old smatch warnings:
drivers/vdpa/octeon_ep/octep_vdpa_hw.c:479 octep_hw_caps_read() warn: argument 3 to %016llx specifier is cast from pointer
drivers/vdpa/octeon_ep/octep_vdpa_hw.c:480 octep_hw_caps_read() warn: argument 3 to %016llx specifier is cast from pointer
drivers/vdpa/octeon_ep/octep_vdpa_hw.c:481 octep_hw_caps_read() warn: argument 3 to %016llx specifier is cast from pointer
drivers/vdpa/octeon_ep/octep_vdpa_hw.c:514 octep_hw_caps_read() warn: argument 3 to %016llx specifier is cast from pointer

vim +/ret +143 drivers/vdpa/octeon_ep/octep_vdpa_hw.c

8b6c724cdab85d Srujana Challa 2024-06-14  102  static int octep_process_mbox(struct octep_hw *oct_hw, u16 id, u16 qid, void *buffer,
8b6c724cdab85d Srujana Challa 2024-06-14  103  			      u32 buf_size, bool write)
8b6c724cdab85d Srujana Challa 2024-06-14  104  {
8b6c724cdab85d Srujana Challa 2024-06-14  105  	struct octep_mbox __iomem *mbox = octep_get_mbox(oct_hw);
8b6c724cdab85d Srujana Challa 2024-06-14  106  	struct pci_dev *pdev = oct_hw->pdev;
8b6c724cdab85d Srujana Challa 2024-06-14  107  	u32 *p = (u32 *)buffer;
8b6c724cdab85d Srujana Challa 2024-06-14  108  	u16 data_wds;
8b6c724cdab85d Srujana Challa 2024-06-14  109  	int ret, i;
8b6c724cdab85d Srujana Challa 2024-06-14  110  	u32 val;
8b6c724cdab85d Srujana Challa 2024-06-14  111  
8b6c724cdab85d Srujana Challa 2024-06-14  112  	if (!IS_ALIGNED(buf_size, 4))
8b6c724cdab85d Srujana Challa 2024-06-14  113  		return -EINVAL;
8b6c724cdab85d Srujana Challa 2024-06-14  114  
8b6c724cdab85d Srujana Challa 2024-06-14  115  	/* Make sure mbox space is available */
8b6c724cdab85d Srujana Challa 2024-06-14  116  	ret = octep_wait_for_mbox_avail(mbox);
8b6c724cdab85d Srujana Challa 2024-06-14  117  	if (ret) {
8b6c724cdab85d Srujana Challa 2024-06-14  118  		dev_warn(&pdev->dev, "Timeout waiting for previous mbox data to be consumed\n");
8b6c724cdab85d Srujana Challa 2024-06-14  119  		return ret;
8b6c724cdab85d Srujana Challa 2024-06-14  120  	}
8b6c724cdab85d Srujana Challa 2024-06-14  121  	data_wds = buf_size / 4;
8b6c724cdab85d Srujana Challa 2024-06-14  122  
8b6c724cdab85d Srujana Challa 2024-06-14  123  	if (write) {
8b6c724cdab85d Srujana Challa 2024-06-14  124  		for (i = 1; i <= data_wds; i++) {
8b6c724cdab85d Srujana Challa 2024-06-14  125  			octep_write32_word(mbox, i, *p);
8b6c724cdab85d Srujana Challa 2024-06-14  126  			p++;
8b6c724cdab85d Srujana Challa 2024-06-14  127  		}
8b6c724cdab85d Srujana Challa 2024-06-14  128  	}
8b6c724cdab85d Srujana Challa 2024-06-14  129  	octep_write32_word(mbox, 0, (u32)qid);
8b6c724cdab85d Srujana Challa 2024-06-14  130  	octep_write_sts(mbox, 0);
8b6c724cdab85d Srujana Challa 2024-06-14  131  
8b6c724cdab85d Srujana Challa 2024-06-14  132  	octep_write_hdr(mbox, id, MBOX_REQ_SIG);
8b6c724cdab85d Srujana Challa 2024-06-14  133  
8b6c724cdab85d Srujana Challa 2024-06-14  134  	ret = octep_wait_for_mbox_rsp(mbox);
8b6c724cdab85d Srujana Challa 2024-06-14  135  	if (ret) {
8b6c724cdab85d Srujana Challa 2024-06-14  136  		dev_warn(&pdev->dev, "Timeout waiting for mbox : %d response\n", id);
8b6c724cdab85d Srujana Challa 2024-06-14  137  		return ret;
8b6c724cdab85d Srujana Challa 2024-06-14  138  	}
8b6c724cdab85d Srujana Challa 2024-06-14  139  
8b6c724cdab85d Srujana Challa 2024-06-14  140  	val = octep_read_sig(mbox);
8b6c724cdab85d Srujana Challa 2024-06-14  141  	if ((val & 0xFFFF) != MBOX_RSP_SIG) {
8b6c724cdab85d Srujana Challa 2024-06-14  142  		dev_warn(&pdev->dev, "Invalid Signature from mbox : %d response\n", id);
8b6c724cdab85d Srujana Challa 2024-06-14 @143  		return ret;

return -EINVAL;

The other warnings are because we should use %p to print pointers.  Depening on
the .config the kernel will mask out pointers so that they aren't disclosed to
the users.  Otherwise it risks being an information leak to defeat KSALR.

8b6c724cdab85d Srujana Challa 2024-06-14  144  	}
8b6c724cdab85d Srujana Challa 2024-06-14  145  
8b6c724cdab85d Srujana Challa 2024-06-14  146  	val = octep_read_sts(mbox);
8b6c724cdab85d Srujana Challa 2024-06-14  147  	if (val & MBOX_RC_MASK) {
8b6c724cdab85d Srujana Challa 2024-06-14  148  		ret = MBOX_RSP_TO_ERR(val);
8b6c724cdab85d Srujana Challa 2024-06-14  149  		dev_warn(&pdev->dev, "Error while processing mbox : %d, err %d\n", id, ret);
8b6c724cdab85d Srujana Challa 2024-06-14  150  		return ret;
8b6c724cdab85d Srujana Challa 2024-06-14  151  	}
8b6c724cdab85d Srujana Challa 2024-06-14  152  
8b6c724cdab85d Srujana Challa 2024-06-14  153  	if (!write)
8b6c724cdab85d Srujana Challa 2024-06-14  154  		for (i = 1; i <= data_wds; i++)
8b6c724cdab85d Srujana Challa 2024-06-14  155  			*p++ = octep_read32_word(mbox, i);
8b6c724cdab85d Srujana Challa 2024-06-14  156  
8b6c724cdab85d Srujana Challa 2024-06-14  157  	return 0;
8b6c724cdab85d Srujana Challa 2024-06-14  158  }

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


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ