X-Git-Url: http://mj.ucw.cz/gitweb/?a=blobdiff_plain;f=lib%2Faix-device.c;h=93a8e4e72f6607d4f9504eae127d05a54cbbaecf;hb=d1058e9dee26b0ae0f8a595e07bfdee20a5fecef;hp=55b2f306dd80ae0a0d492d0bed2fb37449b856c1;hpb=6dd65238a1b203b76dee8cbe09d208b450b0f68c;p=pciutils.git diff --git a/lib/aix-device.c b/lib/aix-device.c index 55b2f30..93a8e4e 100644 --- a/lib/aix-device.c +++ b/lib/aix-device.c @@ -222,8 +222,12 @@ static int aix_read(struct pci_dev *d, int pos, byte *buf, int len) { struct mdio mdio; - int fd = aix_bus_open(d->access, d->bus); + int fd; + if (pos + len > 256) + return 0; + + fd = aix_bus_open(d->access, d->bus); mdio.md_addr = (ulong) pos; mdio.md_size = len; mdio.md_incr = MV_BYTE; @@ -240,8 +244,12 @@ static int aix_write(struct pci_dev *d, int pos, byte *buf, int len) { struct mdio mdio; - int fd = aix_bus_open(d->access, d->bus); + int fd; + + if (pos + len > 256) + return 0; + fd = aix_bus_open(d->access, d->bus); mdio.md_addr = (ulong) pos; mdio.md_size = len; mdio.md_incr = MV_BYTE;