kernel/vfs: Remove read sizing hack in common_file_io_vec_pages.
All drivers using IORequest should have any problems here already caught by it, and overruns in other drivers would overrun the buffer and cause corruptions, so we should no longer silently be ignoring this, presuming it is still a problem at all. As the TODO comment indicated that this logic could also be used for writes if this wasn't a problem, I have added a separate TODO for that.
This commit is contained in:
parent
478c8c847d
commit
81458ef8a6
@ -3489,6 +3489,7 @@ common_file_io_vec_pages(struct vnode* vnode, void* cookie,
|
||||
if (!doWrite && vecOffset == 0) {
|
||||
// now directly read the data from the device
|
||||
// the first file_io_vec can be read directly
|
||||
// TODO: we could also write directly
|
||||
|
||||
if (fileVecs[0].length < (off_t)numBytes)
|
||||
size = fileVecs[0].length;
|
||||
@ -3506,17 +3507,6 @@ common_file_io_vec_pages(struct vnode* vnode, void* cookie,
|
||||
if (status != B_OK)
|
||||
return status;
|
||||
|
||||
// TODO: this is a work-around for buggy device drivers!
|
||||
// When our own drivers honour the length, we can:
|
||||
// a) also use this direct I/O for writes (otherwise, it would
|
||||
// overwrite precious data)
|
||||
// b) panic if the term below is true (at least for writes)
|
||||
if ((off_t)size > fileVecs[0].length) {
|
||||
//dprintf("warning: device driver %p doesn't respect total length "
|
||||
// "in read_pages() call!\n", ref->device);
|
||||
size = fileVecs[0].length;
|
||||
}
|
||||
|
||||
ASSERT((off_t)size <= fileVecs[0].length);
|
||||
|
||||
// If the file portion was contiguous, we're already done now
|
||||
|
Loading…
x
Reference in New Issue
Block a user