Add (char *) casts on pointer arithmetic.
This commit is contained in:
parent
b9fead901a
commit
9fc72fad14
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: disksubr.c,v 1.27 2006/11/25 11:59:57 scw Exp $ */
|
||||
/* $NetBSD: disksubr.c,v 1.28 2007/03/04 10:50:30 tsutsui Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1982, 1986, 1988 Regents of the University of California.
|
||||
|
@ -32,7 +32,7 @@
|
|||
*/
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
__KERNEL_RCSID(0, "$NetBSD: disksubr.c,v 1.27 2006/11/25 11:59:57 scw Exp $");
|
||||
__KERNEL_RCSID(0, "$NetBSD: disksubr.c,v 1.28 2007/03/04 10:50:30 tsutsui Exp $");
|
||||
|
||||
#include <sys/param.h>
|
||||
#include <sys/systm.h>
|
||||
|
@ -87,7 +87,8 @@ readdisklabel(dev_t dev, void (*strat)(struct buf *), struct disklabel *lp,
|
|||
if (biowait(bp))
|
||||
msg = "I/O error";
|
||||
else for (dlp = (struct disklabel *)bp->b_data;
|
||||
dlp <= (struct disklabel *)(bp->b_data + DEV_BSIZE - sizeof(*dlp));
|
||||
dlp <= (struct disklabel *)((char *)bp->b_data + DEV_BSIZE
|
||||
- sizeof(*dlp));
|
||||
dlp = (struct disklabel *)((char *)dlp + sizeof(long))) {
|
||||
if (dlp->d_magic != DISKMAGIC || dlp->d_magic2 != DISKMAGIC) {
|
||||
if (msg == NULL)
|
||||
|
@ -171,8 +172,8 @@ writedisklabel(dev_t dev, void (*strat)(struct buf *), struct disklabel *lp,
|
|||
if ((error = biowait(bp)) != 0)
|
||||
goto done;
|
||||
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))) {
|
||||
if (dlp->d_magic == DISKMAGIC && dlp->d_magic2 == DISKMAGIC &&
|
||||
dkcksum(dlp) == 0) {
|
||||
|
|
Loading…
Reference in New Issue