kernel: add extra negative and power-of-two check to pcibarsize()
This commit is contained in:
parent
2a531d444c
commit
78c7ad88ff
1 changed files with 5 additions and 5 deletions
|
@ -190,16 +190,16 @@ pcibarsize(Pcidev *p, int rno)
|
|||
pcicfgrw32(p->tbdf, rno, v, 0);
|
||||
}
|
||||
}
|
||||
size = -size;
|
||||
|
||||
iunlock(&pcicfglock);
|
||||
|
||||
if(size > 0){
|
||||
print("pcibarsize: %T invalid bar rno %x mask %llux\n",
|
||||
p->tbdf, rno, (uvlong)size);
|
||||
if(size < 0 || (size & size-1) != 0){
|
||||
print("pcibarsize: %T invalid bar rno %#x size %#llux mask %#llux\n",
|
||||
p->tbdf, rno, size, -size);
|
||||
return 0;
|
||||
}
|
||||
|
||||
return -size;
|
||||
return size;
|
||||
}
|
||||
|
||||
void
|
||||
|
|
Loading…
Reference in a new issue