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.
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) {
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");