LKML Archive on lore.kernel.org
help / color / mirror / Atom feed
From: kernel test robot <lkp@intel.com>
To: Megha Dey <megha.dey@intel.com>
Cc: kbuild-all@lists.01.org, linux-kernel@vger.kernel.org
Subject: [meghadey-crypto:d_msix 1/1] drivers/pci/msi.c:1040 __pci_enable_msix() warn: unsigned 'dev->msix_vec_cnt' is never less than zero.
Date: Tue, 31 Aug 2021 08:26:48 +0800	[thread overview]
Message-ID: <202108310846.z9f6F7KN-lkp@intel.com> (raw)

[-- Attachment #1: Type: text/plain, Size: 2273 bytes --]

tree:   https://github.com/meghadey/crypto d_msix
head:   00c6841830531fd32a943ceb9838af5a95a00524
commit: 00c6841830531fd32a943ceb9838af5a95a00524 [1/1] PCI/MSI: Dynamic allocation of MSI-X vectors
config: s390-randconfig-m031-20210830 (attached as .config)
compiler: s390-linux-gcc (GCC) 11.2.0

If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp@intel.com>

smatch warnings:
drivers/pci/msi.c:1040 __pci_enable_msix() warn: unsigned 'dev->msix_vec_cnt' is never less than zero.

vim +1040 drivers/pci/msi.c

  1029	
  1030	static int __pci_enable_msix(struct pci_dev *dev, struct msix_entry *entries,
  1031				     int nvec, struct irq_affinity *affd, int flags)
  1032	{
  1033		int i, j, ret;
  1034	
  1035		if (!pci_msi_supported(dev, nvec) || dev->current_state != PCI_D0)
  1036			return -EINVAL;
  1037	
  1038		dev->msix_vec_cnt = pci_msix_vec_count(dev);
  1039		if (!dev->msix_enabled) {
> 1040			if (dev->msix_vec_cnt < 0)
  1041				return dev->msix_vec_cnt;
  1042			dev->msix_map = kcalloc(BITS_TO_LONGS(dev->msix_vec_cnt), sizeof(long), GFP_KERNEL);
  1043			if (!dev->msix_map)
  1044				return -ENOMEM;
  1045		}
  1046	
  1047		if (nvec > (dev->msix_vec_cnt - dev->msix_alloc_cnt) && !(flags & PCI_IRQ_VIRTUAL))
  1048			return dev->msix_vec_cnt - dev->msix_alloc_cnt;
  1049	
  1050		if (entries) {
  1051			/* Check for any invalid entries */
  1052			for (i = 0; i < nvec; i++) {
  1053				if (entries[i].entry >= dev->msix_vec_cnt)
  1054					return -EINVAL;		/* invalid entry */
  1055				for (j = i + 1; j < nvec; j++) {
  1056					if (entries[i].entry == entries[j].entry)
  1057						return -EINVAL;	/* duplicate entry */
  1058				}
  1059			}
  1060		}
  1061	
  1062		/* Check whether driver already requested for MSI IRQ */
  1063		if (dev->msi_enabled) {
  1064			pci_info(dev, "can't enable MSI-X (MSI IRQ already assigned)\n");
  1065			return -EINVAL;
  1066		}
  1067	
  1068		if (!dev->msix_enabled) {
  1069			ret = msix_setup_table(dev);
  1070			if (ret)
  1071				return ret;
  1072		}
  1073	
  1074		return msix_setup_irqs(dev, entries, nvec, affd);
  1075	}
  1076	

---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org

[-- Attachment #2: .config.gz --]
[-- Type: application/gzip, Size: 36764 bytes --]

                 reply	other threads:[~2021-08-31  0:26 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=202108310846.z9f6F7KN-lkp@intel.com \
    --to=lkp@intel.com \
    --cc=kbuild-all@lists.01.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=megha.dey@intel.com \
    --subject='Re: [meghadey-crypto:d_msix 1/1] drivers/pci/msi.c:1040 __pci_enable_msix() warn: unsigned '\''dev->msix_vec_cnt'\'' is never less than zero.' \
    /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

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).