gvinum: correct assertions

Pointer addresses are always >= 0.  Assert that the value is >= 0
instead.

PR:		207855, 207856
Reviewed by:	imp
Reported by:	David Binderman
Sponsored by:	The FreeBSD Foundation
Differential Revision:	https://reviews.freebsd.org/D37677
This commit is contained in:
Ed Maste 2022-12-12 12:08:39 -05:00 committed by Oscar Zhao
parent ca90fd1686
commit e15794ea99
2 changed files with 3 additions and 3 deletions

View File

@ -173,7 +173,7 @@ gv_plex_offset(struct gv_plex *p, off_t boff, off_t bcount, off_t *real_off,
return (GV_ERR_ISBUSY);
*sdno = stripeno % sdcount;
KASSERT(sdno >= 0, ("gv_plex_offset: sdno < 0"));
KASSERT(*sdno >= 0, ("gv_plex_offset: sdno < 0"));
stripestart = (stripeno / sdcount) *
p->stripesize;
KASSERT(stripestart >= 0, ("gv_plex_offset: stripestart < 0"));

View File

@ -602,7 +602,7 @@ gv_raid5_offset(struct gv_plex *p, off_t boff, off_t bcount, off_t *real_off,
/* The number of the subdisk containing the parity stripe. */
psd = sdcount - 1 - ( boff / (p->stripesize * (sdcount - 1))) %
sdcount;
KASSERT(psdno >= 0, ("gv_raid5_offset: psdno < 0"));
KASSERT(psd >= 0, ("gv_raid5_offset: psdno < 0"));
/* Offset of the start address from the start of the stripe. */
stripeoff = boff % (p->stripesize * (sdcount - 1));
@ -610,7 +610,7 @@ gv_raid5_offset(struct gv_plex *p, off_t boff, off_t bcount, off_t *real_off,
/* The number of the subdisk where the stripe resides. */
sd = stripeoff / p->stripesize;
KASSERT(sdno >= 0, ("gv_raid5_offset: sdno < 0"));
KASSERT(sd >= 0, ("gv_raid5_offset: sdno < 0"));
/* At or past parity subdisk. */
if (sd >= psd)