Cast to char* before doing pointer arithmetic.
This commit is contained in:
parent
d774015c29
commit
a0f301859f
@ -1,4 +1,4 @@
|
|||||||
/* $NetBSD: mmemcard.c,v 1.9 2007/03/04 05:59:44 christos Exp $ */
|
/* $NetBSD: mmemcard.c,v 1.10 2007/03/06 23:50:20 he Exp $ */
|
||||||
|
|
||||||
/*-
|
/*-
|
||||||
* Copyright (c) 2002 The NetBSD Foundation, Inc.
|
* Copyright (c) 2002 The NetBSD Foundation, Inc.
|
||||||
@ -37,7 +37,7 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
#include <sys/cdefs.h>
|
#include <sys/cdefs.h>
|
||||||
__KERNEL_RCSID(0, "$NetBSD: mmemcard.c,v 1.9 2007/03/04 05:59:44 christos Exp $");
|
__KERNEL_RCSID(0, "$NetBSD: mmemcard.c,v 1.10 2007/03/06 23:50:20 he Exp $");
|
||||||
|
|
||||||
#include <sys/param.h>
|
#include <sys/param.h>
|
||||||
#include <sys/buf.h>
|
#include <sys/buf.h>
|
||||||
@ -869,7 +869,7 @@ mmemdone(struct mmem_softc *sc, struct mmem_pt *pt, int err)
|
|||||||
KASSERT(bp);
|
KASSERT(bp);
|
||||||
|
|
||||||
if (err) {
|
if (err) {
|
||||||
bcnt = sc->sc_iobuf - bp->b_data;
|
bcnt = (char *)sc->sc_iobuf - (char *)bp->b_data;
|
||||||
bp->b_resid = bp->b_bcount - bcnt;
|
bp->b_resid = bp->b_bcount - bcnt;
|
||||||
|
|
||||||
/* raise error if no block is read */
|
/* raise error if no block is read */
|
||||||
@ -886,7 +886,8 @@ mmemdone(struct mmem_softc *sc, struct mmem_pt *pt, int err)
|
|||||||
/* terminate current transfer */
|
/* terminate current transfer */
|
||||||
sc->sc_bp = NULL;
|
sc->sc_bp = NULL;
|
||||||
s = splbio();
|
s = splbio();
|
||||||
disk_unbusy(&pt->pt_dk, sc->sc_iobuf - bp->b_data,
|
disk_unbusy(&pt->pt_dk,
|
||||||
|
(char *)sc->sc_iobuf - (char *)bp->b_data,
|
||||||
sc->sc_stat == MMEM_READ);
|
sc->sc_stat == MMEM_READ);
|
||||||
biodone(bp);
|
biodone(bp);
|
||||||
splx(s);
|
splx(s);
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
/* $NetBSD: disksubr.c,v 1.11 2006/11/25 13:09:14 scw Exp $ */
|
/* $NetBSD: disksubr.c,v 1.12 2007/03/07 00:20:57 he Exp $ */
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Copyright (c) 1982, 1986, 1988 Regents of the University of California.
|
* Copyright (c) 1982, 1986, 1988 Regents of the University of California.
|
||||||
@ -32,7 +32,7 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
#include <sys/cdefs.h>
|
#include <sys/cdefs.h>
|
||||||
__KERNEL_RCSID(0, "$NetBSD: disksubr.c,v 1.11 2006/11/25 13:09:14 scw Exp $");
|
__KERNEL_RCSID(0, "$NetBSD: disksubr.c,v 1.12 2007/03/07 00:20:57 he Exp $");
|
||||||
|
|
||||||
#include <sys/param.h>
|
#include <sys/param.h>
|
||||||
#include <sys/systm.h>
|
#include <sys/systm.h>
|
||||||
@ -94,7 +94,8 @@ readdisklabel(dev_t dev, void (*strat)(struct buf *), struct disklabel *lp,
|
|||||||
}
|
}
|
||||||
|
|
||||||
for (dlp = (struct disklabel *)bp->b_data;
|
for (dlp = (struct disklabel *)bp->b_data;
|
||||||
dlp <= (struct disklabel *)(bp->b_data + lp->d_secsize - sizeof(*dlp));
|
dlp <= (struct disklabel *)((char *)bp->b_data + lp->d_secsize -
|
||||||
|
sizeof(*dlp));
|
||||||
dlp = (struct disklabel *)((char *)dlp + sizeof(long))) {
|
dlp = (struct disklabel *)((char *)dlp + sizeof(long))) {
|
||||||
if (dlp->d_magic != DISKMAGIC || dlp->d_magic2 != DISKMAGIC) {
|
if (dlp->d_magic != DISKMAGIC || dlp->d_magic2 != DISKMAGIC) {
|
||||||
if (msg == NULL)
|
if (msg == NULL)
|
||||||
@ -240,7 +241,8 @@ writedisklabel(dev_t dev, void (*strat)(struct buf *), struct disklabel *lp,
|
|||||||
if ((error = biowait(bp)) != 0)
|
if ((error = biowait(bp)) != 0)
|
||||||
goto done;
|
goto done;
|
||||||
for (dlp = (struct disklabel *)bp->b_data;
|
for (dlp = (struct disklabel *)bp->b_data;
|
||||||
dlp <= (struct disklabel *)(bp->b_data + lp->d_secsize - sizeof(*dlp));
|
dlp <= (struct disklabel *)((char *)bp->b_data + lp->d_secsize -
|
||||||
|
sizeof(*dlp));
|
||||||
dlp = (struct disklabel *)((char *)dlp + sizeof(long))) {
|
dlp = (struct disklabel *)((char *)dlp + sizeof(long))) {
|
||||||
if (dlp->d_magic == DISKMAGIC && dlp->d_magic2 == DISKMAGIC &&
|
if (dlp->d_magic == DISKMAGIC && dlp->d_magic2 == DISKMAGIC &&
|
||||||
dkcksum(dlp) == 0) {
|
dkcksum(dlp) == 0) {
|
||||||
|
Loading…
Reference in New Issue
Block a user