public inbox for linux-pci@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] PCI: Fix incorrect retval type in remove_id_store()
@ 2026-02-24 18:14 Alok Tiwari
  2026-03-09 22:20 ` Bjorn Helgaas
  0 siblings, 1 reply; 5+ messages in thread
From: Alok Tiwari @ 2026-02-24 18:14 UTC (permalink / raw)
  To: bhelgaas, linux-pci; +Cc: alok.a.tiwarilinux, alok.a.tiwari

remove_id_store() initializes retval with -ENODEV, but retval was
declared as size_t. Since size_t is unsigned, the negative value is
converted to a large positive number, breaking error handling.

Use ssize_t to match the sysfs store() return type.

Signed-off-by: Alok Tiwari <alok.a.tiwari@oracle.com>
---
 drivers/pci/pci-driver.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/pci/pci-driver.c b/drivers/pci/pci-driver.c
index dd9075403987..b2d3dffcc4f3 100644
--- a/drivers/pci/pci-driver.c
+++ b/drivers/pci/pci-driver.c
@@ -261,7 +261,7 @@ static ssize_t remove_id_store(struct device_driver *driver, const char *buf,
 	u32 vendor, device, subvendor = PCI_ANY_ID,
 		subdevice = PCI_ANY_ID, class = 0, class_mask = 0;
 	int fields;
-	size_t retval = -ENODEV;
+	ssize_t retval = -ENODEV;
 
 	fields = sscanf(buf, "%x %x %x %x %x %x",
 			&vendor, &device, &subvendor, &subdevice,
-- 
2.50.1


^ permalink raw reply related	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2026-03-19 15:45 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-02-24 18:14 [PATCH] PCI: Fix incorrect retval type in remove_id_store() Alok Tiwari
2026-03-09 22:20 ` Bjorn Helgaas
2026-03-10  3:06   ` ALOK TIWARI
2026-03-10 16:03     ` Bjorn Helgaas
2026-03-19 15:45       ` ALOK TIWARI

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox