All of lore.kernel.org
 help / color / mirror / Atom feed
From: kernel test robot <lkp@intel.com>
To: Bjorn Helgaas <helgaas@kernel.org>
Cc: clang-built-linux@googlegroups.com, kbuild-all@lists.01.org,
	linux-pci@vger.kernel.org, Hannes Reinecke <hare@suse.de>
Subject: [pci:wip/bjorn-vpd-v2 5/9] drivers/pci/vpd.c:89:7: warning: format specifies type 'size_t' (aka 'unsigned long') but the argument has type 'unsigned char'
Date: Sat, 31 Jul 2021 06:04:10 +0800	[thread overview]
Message-ID: <202107310602.vLHoTLr2-lkp@intel.com> (raw)

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

tree:   https://git.kernel.org/pub/scm/linux/kernel/git/helgaas/pci.git wip/bjorn-vpd-v2
head:   d4466f3225fe2067d1a815ce03e1ab7abc6c3c28
commit: 49c5c3061498060f93d08a2386503596e0ff14be [5/9] PCI/VPD: Don't check Large Resource Item Names for validity
config: x86_64-randconfig-c001-20210730 (attached as .config)
compiler: clang version 13.0.0 (https://github.com/llvm/llvm-project 4f71f59bf3d9914188a11d0c41bedbb339d36ff5)
reproduce (this is a W=1 build):
        wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
        chmod +x ~/bin/make.cross
        # https://git.kernel.org/pub/scm/linux/kernel/git/helgaas/pci.git/commit/?id=49c5c3061498060f93d08a2386503596e0ff14be
        git remote add pci https://git.kernel.org/pub/scm/linux/kernel/git/helgaas/pci.git
        git fetch --no-tags pci wip/bjorn-vpd-v2
        git checkout 49c5c3061498060f93d08a2386503596e0ff14be
        # save the attached .config to linux build tree
        COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross ARCH=x86_64 

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

All warnings (new ones prefixed by >>):

>> drivers/pci/vpd.c:89:7: warning: format specifies type 'size_t' (aka 'unsigned long') but the argument has type 'unsigned char' [-Wformat]
                                            tag, off + 1);
                                            ^~~
   include/linux/pci.h:2465:67: note: expanded from macro 'pci_warn'
   #define pci_warn(pdev, fmt, arg...)     dev_warn(&(pdev)->dev, fmt, ##arg)
                                                                  ~~~    ^~~
   include/linux/dev_printk.h:114:33: note: expanded from macro 'dev_warn'
           _dev_warn(dev, dev_fmt(fmt), ##__VA_ARGS__)
                                  ~~~     ^~~~~~~~~~~
>> drivers/pci/vpd.c:89:12: warning: data argument not used by format string [-Wformat-extra-args]
                                            tag, off + 1);
                                                 ^
   include/linux/pci.h:2465:67: note: expanded from macro 'pci_warn'
   #define pci_warn(pdev, fmt, arg...)     dev_warn(&(pdev)->dev, fmt, ##arg)
                                                                  ~~~    ^
   include/linux/dev_printk.h:114:33: note: expanded from macro 'dev_warn'
           _dev_warn(dev, dev_fmt(fmt), ##__VA_ARGS__)
                                  ~~~     ^
>> drivers/pci/vpd.c:89:7: warning: variable 'tag' is uninitialized when used here [-Wuninitialized]
                                            tag, off + 1);
                                            ^~~
   include/linux/pci.h:2465:67: note: expanded from macro 'pci_warn'
   #define pci_warn(pdev, fmt, arg...)     dev_warn(&(pdev)->dev, fmt, ##arg)
                                                                         ^~~
   include/linux/dev_printk.h:114:33: note: expanded from macro 'dev_warn'
           _dev_warn(dev, dev_fmt(fmt), ##__VA_ARGS__)
                                          ^~~~~~~~~~~
   drivers/pci/vpd.c:79:20: note: initialize the variable 'tag' to silence this warning
                   unsigned char tag;
                                    ^
                                     = '\0'
   3 warnings generated.


vim +89 drivers/pci/vpd.c

    67	
    68	/**
    69	 * pci_vpd_size - determine actual size of Vital Product Data
    70	 * @dev:	pci device struct
    71	 * @old_size:	current assumed size, also maximum allowed size
    72	 */
    73	static size_t pci_vpd_size(struct pci_dev *dev, size_t old_size)
    74	{
    75		size_t off = 0;
    76		unsigned char header[1+2];	/* 1 byte tag, 2 bytes length */
    77	
    78		while (off < old_size && pci_read_vpd(dev, off, 1, header) == 1) {
    79			unsigned char tag;
    80			size_t size;
    81	
    82			if (off == 0 && (header[0] == 0x00 || header[0] == 0xff))
    83				goto error;
    84	
    85			if (header[0] & PCI_VPD_LRDT) {
    86				/* Large Resource Data Type Tag */
    87				if (pci_read_vpd(dev, off + 1, 2, &header[1]) != 2) {
    88					pci_warn(dev, "failed VPD read at offset %zu\n",
  > 89						 tag, off + 1);
    90					return 0;
    91				}
    92				size = pci_vpd_lrdt_size(header);
    93				if (off + size > PCI_VPD_MAX_SIZE)
    94					goto error;
    95	
    96				off += PCI_VPD_LRDT_TAG_SIZE + size;
    97			} else {
    98				/* Short Resource Data Type Tag */
    99				tag = pci_vpd_srdt_tag(header);
   100				size = pci_vpd_srdt_size(header);
   101				if (size == 0 || off + size > PCI_VPD_MAX_SIZE)
   102					goto error;
   103	
   104				off += PCI_VPD_SRDT_TAG_SIZE + size;
   105				if (tag == PCI_VPD_STIN_END)	/* End tag descriptor */
   106					return off;
   107			}
   108		}
   109		return 0;
   110	
   111	error:
   112		pci_info(dev, "invalid VPD tag %#04x at offset %zu%s\n",
   113			 header[0], off, off == 0 ?
   114			 "; assume missing optional EEPROM" : "");
   115		return 0;
   116	}
   117	

---
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: 28757 bytes --]

WARNING: multiple messages have this Message-ID (diff)
From: kernel test robot <lkp@intel.com>
To: kbuild-all@lists.01.org
Subject: [pci:wip/bjorn-vpd-v2 5/9] drivers/pci/vpd.c:89:7: warning: format specifies type 'size_t' (aka 'unsigned long') but the argument has type 'unsigned char'
Date: Sat, 31 Jul 2021 06:04:10 +0800	[thread overview]
Message-ID: <202107310602.vLHoTLr2-lkp@intel.com> (raw)

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

tree:   https://git.kernel.org/pub/scm/linux/kernel/git/helgaas/pci.git wip/bjorn-vpd-v2
head:   d4466f3225fe2067d1a815ce03e1ab7abc6c3c28
commit: 49c5c3061498060f93d08a2386503596e0ff14be [5/9] PCI/VPD: Don't check Large Resource Item Names for validity
config: x86_64-randconfig-c001-20210730 (attached as .config)
compiler: clang version 13.0.0 (https://github.com/llvm/llvm-project 4f71f59bf3d9914188a11d0c41bedbb339d36ff5)
reproduce (this is a W=1 build):
        wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
        chmod +x ~/bin/make.cross
        # https://git.kernel.org/pub/scm/linux/kernel/git/helgaas/pci.git/commit/?id=49c5c3061498060f93d08a2386503596e0ff14be
        git remote add pci https://git.kernel.org/pub/scm/linux/kernel/git/helgaas/pci.git
        git fetch --no-tags pci wip/bjorn-vpd-v2
        git checkout 49c5c3061498060f93d08a2386503596e0ff14be
        # save the attached .config to linux build tree
        COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross ARCH=x86_64 

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

All warnings (new ones prefixed by >>):

>> drivers/pci/vpd.c:89:7: warning: format specifies type 'size_t' (aka 'unsigned long') but the argument has type 'unsigned char' [-Wformat]
                                            tag, off + 1);
                                            ^~~
   include/linux/pci.h:2465:67: note: expanded from macro 'pci_warn'
   #define pci_warn(pdev, fmt, arg...)     dev_warn(&(pdev)->dev, fmt, ##arg)
                                                                  ~~~    ^~~
   include/linux/dev_printk.h:114:33: note: expanded from macro 'dev_warn'
           _dev_warn(dev, dev_fmt(fmt), ##__VA_ARGS__)
                                  ~~~     ^~~~~~~~~~~
>> drivers/pci/vpd.c:89:12: warning: data argument not used by format string [-Wformat-extra-args]
                                            tag, off + 1);
                                                 ^
   include/linux/pci.h:2465:67: note: expanded from macro 'pci_warn'
   #define pci_warn(pdev, fmt, arg...)     dev_warn(&(pdev)->dev, fmt, ##arg)
                                                                  ~~~    ^
   include/linux/dev_printk.h:114:33: note: expanded from macro 'dev_warn'
           _dev_warn(dev, dev_fmt(fmt), ##__VA_ARGS__)
                                  ~~~     ^
>> drivers/pci/vpd.c:89:7: warning: variable 'tag' is uninitialized when used here [-Wuninitialized]
                                            tag, off + 1);
                                            ^~~
   include/linux/pci.h:2465:67: note: expanded from macro 'pci_warn'
   #define pci_warn(pdev, fmt, arg...)     dev_warn(&(pdev)->dev, fmt, ##arg)
                                                                         ^~~
   include/linux/dev_printk.h:114:33: note: expanded from macro 'dev_warn'
           _dev_warn(dev, dev_fmt(fmt), ##__VA_ARGS__)
                                          ^~~~~~~~~~~
   drivers/pci/vpd.c:79:20: note: initialize the variable 'tag' to silence this warning
                   unsigned char tag;
                                    ^
                                     = '\0'
   3 warnings generated.


vim +89 drivers/pci/vpd.c

    67	
    68	/**
    69	 * pci_vpd_size - determine actual size of Vital Product Data
    70	 * @dev:	pci device struct
    71	 * @old_size:	current assumed size, also maximum allowed size
    72	 */
    73	static size_t pci_vpd_size(struct pci_dev *dev, size_t old_size)
    74	{
    75		size_t off = 0;
    76		unsigned char header[1+2];	/* 1 byte tag, 2 bytes length */
    77	
    78		while (off < old_size && pci_read_vpd(dev, off, 1, header) == 1) {
    79			unsigned char tag;
    80			size_t size;
    81	
    82			if (off == 0 && (header[0] == 0x00 || header[0] == 0xff))
    83				goto error;
    84	
    85			if (header[0] & PCI_VPD_LRDT) {
    86				/* Large Resource Data Type Tag */
    87				if (pci_read_vpd(dev, off + 1, 2, &header[1]) != 2) {
    88					pci_warn(dev, "failed VPD read@offset %zu\n",
  > 89						 tag, off + 1);
    90					return 0;
    91				}
    92				size = pci_vpd_lrdt_size(header);
    93				if (off + size > PCI_VPD_MAX_SIZE)
    94					goto error;
    95	
    96				off += PCI_VPD_LRDT_TAG_SIZE + size;
    97			} else {
    98				/* Short Resource Data Type Tag */
    99				tag = pci_vpd_srdt_tag(header);
   100				size = pci_vpd_srdt_size(header);
   101				if (size == 0 || off + size > PCI_VPD_MAX_SIZE)
   102					goto error;
   103	
   104				off += PCI_VPD_SRDT_TAG_SIZE + size;
   105				if (tag == PCI_VPD_STIN_END)	/* End tag descriptor */
   106					return off;
   107			}
   108		}
   109		return 0;
   110	
   111	error:
   112		pci_info(dev, "invalid VPD tag %#04x at offset %zu%s\n",
   113			 header[0], off, off == 0 ?
   114			 "; assume missing optional EEPROM" : "");
   115		return 0;
   116	}
   117	

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

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

             reply	other threads:[~2021-07-30 22:05 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-07-30 22:04 kernel test robot [this message]
2021-07-30 22:04 ` [pci:wip/bjorn-vpd-v2 5/9] drivers/pci/vpd.c:89:7: warning: format specifies type 'size_t' (aka 'unsigned long') but the argument has type 'unsigned char' kernel test robot

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=202107310602.vLHoTLr2-lkp@intel.com \
    --to=lkp@intel.com \
    --cc=clang-built-linux@googlegroups.com \
    --cc=hare@suse.de \
    --cc=helgaas@kernel.org \
    --cc=kbuild-all@lists.01.org \
    --cc=linux-pci@vger.kernel.org \
    /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.