On Thu, 2008-09-25 at 09:48 -0700, Stephen Hemminger wrote: [...] > -static int pci_vpd_pci22_write(struct pci_dev *dev, int pos, int size, > - const char *buf) > +static ssize_t pci_vpd_pci22_write(struct pci_dev *dev, loff_t pos, size_t count, > + const void *arg) > { > struct pci_vpd_pci22 *vpd = > container_of(dev->vpd, struct pci_vpd_pci22, base); > - u32 val; > + const u8 *buf = arg; > + loff_t end = pos + count; count should be (count & ~3) > int ret = 0; > > - if (pos < 0 || pos > vpd->base.len || pos & 3 || > - size > vpd->base.len - pos || size < 4) > + if (pos > vpd->base.len || pos & 3) > return -EINVAL; Why did you remove the tests for pos < 0 and size > vpd->base.len - pos? I know write_vpd_attr() checks these but you're about to add other callers. [...] > out: > mutex_unlock(&vpd->lock); > - if (ret < 0) > - return ret; > - > - return 4; > + return ret ? ret : count; > } [...] count should be (count & ~3) Alternately you could treat (count & 3) != 0 as invalid. Ben. -- Ben Hutchings, Senior Software Engineer, Solarflare Communications Not speaking for my employer; that's the marketing department's job. They asked us to note that Solarflare product names are trademarked. -- To unsubscribe from this list: send the line "unsubscribe linux-pci" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html