Fix some arithmetics lossage on typeless pointers.

This commit is contained in:
kleink 1998-05-08 18:18:55 +00:00
parent 7482c120bd
commit fe2d01988e
5 changed files with 30 additions and 26 deletions

View File

@ -1,4 +1,4 @@
/* $NetBSD: exec_elf32.c,v 1.28 1998/03/01 02:22:27 fvdl Exp $ */
/* $NetBSD: exec_elf32.c,v 1.29 1998/05/08 18:18:55 kleink Exp $ */
/*
* Copyright (c) 1996 Christopher G. Demetriou
@ -187,7 +187,7 @@ ELFNAME(copyargs)(pack, arginfo, stack, argp)
len = (a - ai) * sizeof (AuxInfo);
if (copyout(ai, stack, len))
return NULL;
stack += len;
(caddr_t)stack += len;
return stack;
}

View File

@ -1,4 +1,4 @@
/* $NetBSD: kern_physio.c,v 1.31 1998/04/30 06:28:57 thorpej Exp $ */
/* $NetBSD: kern_physio.c,v 1.32 1998/05/08 18:18:58 kleink Exp $ */
/*-
* Copyright (c) 1994 Christopher G. Demetriou
@ -248,7 +248,7 @@ physio(strategy, bp, dev, flags, minphys, uio)
panic("done > todo; strategy broken");
#endif
iovp->iov_len -= done;
iovp->iov_base += done;
(caddr_t)iovp->iov_base += done;
uio->uio_offset += done;
uio->uio_resid -= done;

View File

@ -1,4 +1,4 @@
/* $NetBSD: kern_subr.c,v 1.38 1998/03/01 02:22:30 fvdl Exp $ */
/* $NetBSD: kern_subr.c,v 1.39 1998/05/08 18:18:59 kleink Exp $ */
/*-
* Copyright (c) 1997, 1998 The NetBSD Foundation, Inc.
@ -169,7 +169,7 @@ uiomove(buf, n, uio)
#endif
break;
}
iov->iov_base += cnt;
(caddr_t)iov->iov_base += cnt;
iov->iov_len -= cnt;
uio->uio_resid -= cnt;
uio->uio_offset += cnt;
@ -208,10 +208,10 @@ again:
break;
case UIO_SYSSPACE:
*iov->iov_base = c;
*(char *)iov->iov_base = c;
break;
}
iov->iov_base++;
((caddr_t)iov->iov_base)++;
iov->iov_len--;
uio->uio_resid--;
uio->uio_offset++;

View File

@ -1,4 +1,4 @@
/* $NetBSD: nfs_subs.c,v 1.57 1998/03/03 13:38:32 fvdl Exp $ */
/* $NetBSD: nfs_subs.c,v 1.58 1998/05/08 18:26:54 kleink Exp $ */
/*
* Copyright (c) 1989, 1993
@ -820,7 +820,7 @@ nfsm_mbuftouio(mrep, uiop, siz, dpos)
uiop->uio_iovcnt--;
uiop->uio_iov++;
} else {
uiop->uio_iov->iov_base += uiosiz;
(caddr_t)uiop->uio_iov->iov_base += uiosiz;
uiop->uio_iov->iov_len -= uiosiz;
}
siz -= uiosiz;
@ -899,7 +899,7 @@ nfsm_uiotombuf(uiop, mq, siz, bpos)
uiop->uio_offset += xfer;
uiop->uio_resid -= xfer;
}
uiop->uio_iov->iov_base += uiosiz;
(caddr_t)uiop->uio_iov->iov_base += uiosiz;
uiop->uio_iov->iov_len -= uiosiz;
siz -= uiosiz;
}

View File

@ -1,4 +1,4 @@
/* $NetBSD: nfs_vnops.c,v 1.90 1998/03/03 00:17:04 fvdl Exp $ */
/* $NetBSD: nfs_vnops.c,v 1.91 1998/05/08 18:26:55 kleink Exp $ */
/*
* Copyright (c) 1989, 1993
@ -1170,7 +1170,8 @@ nfs_writerpc(vp, uiop, cred, iomode, must_commit)
break;
} else if (rlen < len) {
backup = len - rlen;
uiop->uio_iov->iov_base -= backup;
(caddr_t)uiop->uio_iov->iov_base -=
backup;
uiop->uio_iov->iov_len += backup;
uiop->uio_offset -= backup;
uiop->uio_resid += backup;
@ -2026,7 +2027,8 @@ nfs_readdir(v)
*/
if (uio->uio_segflg != UIO_SYSSPACE || uio->uio_iovcnt != 1)
panic("nfs_readdir: lost in space");
for (nc = 0; ncookies-- && base < uio->uio_iov->iov_base; nc++){
for (nc = 0; ncookies-- &&
base < (char *)uio->uio_iov->iov_base; nc++){
dp = (struct dirent *) base;
if (dp->d_reclen == 0)
break;
@ -2036,8 +2038,10 @@ nfs_readdir(v)
*(cookies++) = NFS_GETCOOKIE(dp);
base += dp->d_reclen;
}
uio->uio_resid += (uio->uio_iov->iov_base - base);
uio->uio_iov->iov_len += (uio->uio_iov->iov_base - base);
uio->uio_resid +=
((caddr_t)uio->uio_iov->iov_base - base);
uio->uio_iov->iov_len +=
((caddr_t)uio->uio_iov->iov_base - base);
uio->uio_iov->iov_base = base;
*ap->a_ncookies = nc;
}
@ -2161,7 +2165,7 @@ nfs_readdirrpc(vp, uiop, cred)
left = NFS_DIRFRAGSIZ - blksiz;
if (reclen > left) {
dp->d_reclen += left;
uiop->uio_iov->iov_base += left;
(caddr_t)uiop->uio_iov->iov_base += left;
uiop->uio_iov->iov_len -= left;
uiop->uio_resid -= left;
blksiz = 0;
@ -2179,13 +2183,13 @@ nfs_readdirrpc(vp, uiop, cred)
if (blksiz == NFS_DIRFRAGSIZ)
blksiz = 0;
uiop->uio_resid -= DIRHDSIZ;
uiop->uio_iov->iov_base += DIRHDSIZ;
(caddr_t)uiop->uio_iov->iov_base += DIRHDSIZ;
uiop->uio_iov->iov_len -= DIRHDSIZ;
nfsm_mtouio(uiop, len);
cp = uiop->uio_iov->iov_base;
tlen -= len;
*cp = '\0'; /* null terminate */
uiop->uio_iov->iov_base += tlen;
(caddr_t)uiop->uio_iov->iov_base += tlen;
uiop->uio_iov->iov_len -= tlen;
uiop->uio_resid -= tlen;
} else
@ -2235,7 +2239,7 @@ nfs_readdirrpc(vp, uiop, cred)
left = NFS_DIRFRAGSIZ - blksiz;
dp->d_reclen += left;
NFS_STASHCOOKIE(dp, uiop->uio_offset);
uiop->uio_iov->iov_base += left;
(caddr_t)uiop->uio_iov->iov_base += left;
uiop->uio_iov->iov_len -= left;
uiop->uio_resid -= left;
}
@ -2345,7 +2349,7 @@ nfs_readdirplusrpc(vp, uiop, cred)
* again here.
*/
dp->d_reclen += left;
uiop->uio_iov->iov_base += left;
(caddr_t)uiop->uio_iov->iov_base += left;
uiop->uio_iov->iov_len -= left;
uiop->uio_resid -= left;
NFS_STASHCOOKIE(dp, uiop->uio_offset);
@ -2363,7 +2367,7 @@ nfs_readdirplusrpc(vp, uiop, cred)
if (blksiz == NFS_DIRFRAGSIZ)
blksiz = 0;
uiop->uio_resid -= DIRHDSIZ;
uiop->uio_iov->iov_base += DIRHDSIZ;
(caddr_t)uiop->uio_iov->iov_base += DIRHDSIZ;
uiop->uio_iov->iov_len -= DIRHDSIZ;
cnp->cn_nameptr = uiop->uio_iov->iov_base;
cnp->cn_namelen = len;
@ -2371,7 +2375,7 @@ nfs_readdirplusrpc(vp, uiop, cred)
cp = uiop->uio_iov->iov_base;
tlen -= len;
*cp = '\0';
uiop->uio_iov->iov_base += tlen;
(caddr_t)uiop->uio_iov->iov_base += tlen;
uiop->uio_iov->iov_len -= tlen;
uiop->uio_resid -= tlen;
} else
@ -2455,7 +2459,7 @@ nfs_readdirplusrpc(vp, uiop, cred)
left = NFS_DIRFRAGSIZ - blksiz;
dp->d_reclen += left;
NFS_STASHCOOKIE(dp, uiop->uio_offset);
uiop->uio_iov->iov_base += left;
(caddr_t)uiop->uio_iov->iov_base += left;
uiop->uio_iov->iov_len -= left;
uiop->uio_resid -= left;
}