Constrain the amount of data returned to what is actually available
not the size of the buffer. Approved by: grehan (co-mentor)
This commit is contained in:
parent
8fe02cef86
commit
28bb12a94c
@ -543,12 +543,14 @@ write_prdt(struct ahci_port *p, int slot, uint8_t *cfis,
|
||||
for (i = 0; i < hdr->prdtl && len; i++) {
|
||||
uint8_t *ptr;
|
||||
uint32_t dbcsz;
|
||||
int sublen;
|
||||
|
||||
dbcsz = (prdt->dbc & DBCMASK) + 1;
|
||||
ptr = paddr_guest2host(ahci_ctx(p->pr_sc), prdt->dba, dbcsz);
|
||||
memcpy(ptr, from, dbcsz);
|
||||
len -= dbcsz;
|
||||
from += dbcsz;
|
||||
sublen = len < dbcsz ? len : dbcsz;
|
||||
memcpy(ptr, from, sublen);
|
||||
len -= sublen;
|
||||
from += sublen;
|
||||
prdt++;
|
||||
}
|
||||
hdr->prdbc = size - len;
|
||||
|
Loading…
x
Reference in New Issue
Block a user