(bread): For a read that is contained entirely within a block, never copy
out more than size bytes to the caller's buffer. PR: bin/111191 Reviewed by: pb MFC after: 1 week
This commit is contained in:
parent
9760f68ca0
commit
993425ee98
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=168392
@ -925,7 +925,7 @@ bread(ufs2_daddr_t blkno, char *buf, int size)
|
|||||||
cnt = cread(diskfd, tmpbuf, secsize, offset - base);
|
cnt = cread(diskfd, tmpbuf, secsize, offset - base);
|
||||||
if (cnt != secsize)
|
if (cnt != secsize)
|
||||||
goto bad;
|
goto bad;
|
||||||
xfer = secsize - base;
|
xfer = MIN(secsize - base, size);
|
||||||
offset += xfer;
|
offset += xfer;
|
||||||
bytes -= xfer;
|
bytes -= xfer;
|
||||||
resid = bytes % secsize;
|
resid = bytes % secsize;
|
||||||
|
Loading…
Reference in New Issue
Block a user