Skip to content

Commit 357df2f

Browse files
kwilczynskibjorn-helgaas
authored andcommitted
PCI: Use unsigned to match sscanf("%x") in pci_dev_str_match_path()
Cppcheck warns that pci_dev_str_match_path() passes pointers to signed ints to sscanf("%x"), which expects pointers to *unsigned* ints: invalidScanfArgType_int drivers/pci/pci.c:312 %x in format string (no. 2) requires 'unsigned int *' but the argument type is 'signed int *'. Declare the variables as unsigned to avoid this issue. [bhelgaas: commit log] Link: https://lore.kernel.org/r/20211008222732.2868493-3-kw@linux.com Signed-off-by: Krzysztof Wilczyński <kw@linux.com> Signed-off-by: Bjorn Helgaas <bhelgaas@google.com>
1 parent f183120 commit 357df2f

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

drivers/pci/pci.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -269,7 +269,7 @@ static int pci_dev_str_match_path(struct pci_dev *dev, const char *path,
269269
const char **endptr)
270270
{
271271
int ret;
272-
int seg, bus, slot, func;
272+
unsigned int seg, bus, slot, func;
273273
char *wpath, *p;
274274
char end;
275275

0 commit comments

Comments
 (0)