All of lore.kernel.org
 help / color / mirror / Atom feed
From: kernel test robot <lkp@intel.com>
To: oe-kbuild@lists.linux.dev
Cc: lkp@intel.com, Dan Carpenter <error27@gmail.com>
Subject: [android-common:android16-6.12-kminext 1/1] drivers/misc/pci_endpoint_test.c:292 pci_endpoint_test_bar() warn: signedness bug returning '(-61)'
Date: Sun, 18 Oct 2026 09:43:36 +0200	[thread overview]
Message-ID: <202610170051.ZaPQhbIG-lkp@intel.com> (raw)

Unfiltered warning: this smatch report is sent as-is and has not been
reviewed for false positives, so please treat it with due skepticism.

BCC: lkp@intel.com
CC: oe-kbuild-all@lists.linux.dev
TO: cros-kernel-buildreports@googlegroups.com

tree:   https://android.googlesource.com/kernel/common android16-6.12-kminext
head:   a42b417921ddca2df90dc3d8cb746eda8cdb6d63
commit: f615e8d2dec6746127d4667c3cae81bfd6a1ed3a [1/1] misc: pci_endpoint_test: Give disabled BARs a distinct error code
:::::: branch date: 27 hours ago
:::::: commit date: 1 year, 5 months ago
config: i386-randconfig-2200-20261016 (https://download.01.org/0day-ci/archive/20261017/202610170051.ZaPQhbIG-lkp@intel.com/config)
compiler: clang version 22.1.8 (https://github.com/llvm/llvm-project ca7933e47d3a3451d81e72ac174dcb5aa28b59d1)
smatch: v0.5.0-9187-g5189e3fb

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 <error27@gmail.com>
| Closes: https://lore.kernel.org/r/202610170051.ZaPQhbIG-lkp@intel.com/

smatch warnings:
drivers/misc/pci_endpoint_test.c:292 pci_endpoint_test_bar() warn: signedness bug returning '(-61)'

vim +292 drivers/misc/pci_endpoint_test.c

2a35703a6a00e87 Niklas Cassel          2024-03-22  281  
2c156ac71c6b251 Kishon Vijay Abraham I 2017-03-27  282  static bool pci_endpoint_test_bar(struct pci_endpoint_test *test,
2c156ac71c6b251 Kishon Vijay Abraham I 2017-03-27  283  				  enum pci_barno barno)
2c156ac71c6b251 Kishon Vijay Abraham I 2017-03-27  284  {
2a35703a6a00e87 Niklas Cassel          2024-03-22  285  	int j, bar_size, buf_size, iters, remain;
2a35703a6a00e87 Niklas Cassel          2024-03-22  286  	void *write_buf __free(kfree) = NULL;
2a35703a6a00e87 Niklas Cassel          2024-03-22  287  	void *read_buf __free(kfree) = NULL;
cda370ec6d1f7b2 Kishon Vijay Abraham I 2017-08-18  288  	struct pci_dev *pdev = test->pdev;
2c156ac71c6b251 Kishon Vijay Abraham I 2017-03-27  289  
f615e8d2dec6746 Niklas Cassel          2025-01-23  290  	bar_size = pci_resource_len(pdev, barno);
f615e8d2dec6746 Niklas Cassel          2025-01-23  291  	if (!bar_size)
f615e8d2dec6746 Niklas Cassel          2025-01-23 @292  		return -ENODATA;
f615e8d2dec6746 Niklas Cassel          2025-01-23  293  
2c156ac71c6b251 Kishon Vijay Abraham I 2017-03-27  294  	if (!test->bar[barno])
2c156ac71c6b251 Kishon Vijay Abraham I 2017-03-27  295  		return false;
2c156ac71c6b251 Kishon Vijay Abraham I 2017-03-27  296  
834b9051992580a Kishon Vijay Abraham I 2017-08-18  297  	if (barno == test->test_reg_bar)
2a35703a6a00e87 Niklas Cassel          2024-03-22  298  		bar_size = 0x4;
834b9051992580a Kishon Vijay Abraham I 2017-08-18  299  
2a35703a6a00e87 Niklas Cassel          2024-03-22  300  	/*
2a35703a6a00e87 Niklas Cassel          2024-03-22  301  	 * Allocate a buffer of max size 1MB, and reuse that buffer while
2a35703a6a00e87 Niklas Cassel          2024-03-22  302  	 * iterating over the whole BAR size (which might be much larger).
2a35703a6a00e87 Niklas Cassel          2024-03-22  303  	 */
2a35703a6a00e87 Niklas Cassel          2024-03-22  304  	buf_size = min(SZ_1M, bar_size);
2c156ac71c6b251 Kishon Vijay Abraham I 2017-03-27  305  
2a35703a6a00e87 Niklas Cassel          2024-03-22  306  	write_buf = kmalloc(buf_size, GFP_KERNEL);
2a35703a6a00e87 Niklas Cassel          2024-03-22  307  	if (!write_buf)
2a35703a6a00e87 Niklas Cassel          2024-03-22  308  		return false;
2a35703a6a00e87 Niklas Cassel          2024-03-22  309  
2a35703a6a00e87 Niklas Cassel          2024-03-22  310  	read_buf = kmalloc(buf_size, GFP_KERNEL);
2a35703a6a00e87 Niklas Cassel          2024-03-22  311  	if (!read_buf)
2a35703a6a00e87 Niklas Cassel          2024-03-22  312  		return false;
2a35703a6a00e87 Niklas Cassel          2024-03-22  313  
2a35703a6a00e87 Niklas Cassel          2024-03-22  314  	iters = bar_size / buf_size;
2a35703a6a00e87 Niklas Cassel          2024-03-22  315  	for (j = 0; j < iters; j++)
2a35703a6a00e87 Niklas Cassel          2024-03-22  316  		if (pci_endpoint_test_bar_memcmp(test, barno, buf_size * j,
2a35703a6a00e87 Niklas Cassel          2024-03-22  317  						 write_buf, read_buf, buf_size))
2a35703a6a00e87 Niklas Cassel          2024-03-22  318  			return false;
2a35703a6a00e87 Niklas Cassel          2024-03-22  319  
2a35703a6a00e87 Niklas Cassel          2024-03-22  320  	remain = bar_size % buf_size;
2a35703a6a00e87 Niklas Cassel          2024-03-22  321  	if (remain)
2a35703a6a00e87 Niklas Cassel          2024-03-22  322  		if (pci_endpoint_test_bar_memcmp(test, barno, buf_size * iters,
2a35703a6a00e87 Niklas Cassel          2024-03-22  323  						 write_buf, read_buf, remain))
2c156ac71c6b251 Kishon Vijay Abraham I 2017-03-27  324  			return false;
2c156ac71c6b251 Kishon Vijay Abraham I 2017-03-27  325  
2c156ac71c6b251 Kishon Vijay Abraham I 2017-03-27  326  	return true;
2c156ac71c6b251 Kishon Vijay Abraham I 2017-03-27  327  }
2c156ac71c6b251 Kishon Vijay Abraham I 2017-03-27  328  

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

                 reply	other threads:[~2026-10-18  7:52 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=202610170051.ZaPQhbIG-lkp@intel.com \
    --to=lkp@intel.com \
    --cc=error27@gmail.com \
    --cc=oe-kbuild@lists.linux.dev \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.