Compare read/write buf size against SSIZE_MAX instead of "< 0"
The nbyte in read(int fildes, void *buf, size_t nbyte) is unsigned, so although technically we're doing the same comparison, this is more in line with POSIX. The comparison was moved to read_write as that routine is used within VFS to let it VFS write out coredumps.
This commit is contained in:
parent
9f9f893123
commit
54c0eb9aa6
1 changed files with 2 additions and 3 deletions
|
@ -78,9 +78,6 @@ int rw_flag; /* READING or WRITING */
|
|||
tll_access_t locktype;
|
||||
int r;
|
||||
|
||||
/* If the file descriptor is valid, get the vnode, size and mode. */
|
||||
if (m_in.nbytes < 0) return(EINVAL);
|
||||
|
||||
locktype = (rw_flag == READING) ? VNODE_READ : VNODE_WRITE;
|
||||
if ((f = get_filp(m_in.fd, locktype)) == NULL) return(err_code);
|
||||
if (((f->filp_mode) & (rw_flag == READING ? R_BIT : W_BIT)) == 0) {
|
||||
|
@ -116,6 +113,8 @@ PUBLIC int read_write(int rw_flag, struct filp *f, char *buf, size_t size,
|
|||
r = OK;
|
||||
cum_io = 0;
|
||||
|
||||
if (size > SSIZE_MAX) return(EINVAL);
|
||||
|
||||
if (vp->v_pipe == I_PIPE) {
|
||||
if (fp->fp_cum_io_partial != 0) {
|
||||
panic("VFS: read_write: fp_cum_io_partial not clear");
|
||||
|
|
Loading…
Reference in a new issue