diff --git a/drivers/pci/proc.c b/drivers/pci/proc.c index 71ad289fcb8e..fcbd75d53ac5 100644 --- a/drivers/pci/proc.c +++ b/drivers/pci/proc.c @@ -46,6 +46,9 @@ static ssize_t proc_bus_pci_read(struct file *file, char __user *buf, else size = 64; + if (!nbytes) + return 0; + if (pos >= size) return 0; if (nbytes >= size) @@ -122,6 +125,9 @@ static ssize_t proc_bus_pci_write(struct file *file, const char __user *buf, if (ret) return ret; + if (!nbytes) + return 0; + if (pos >= size) return 0; if (nbytes >= size)