git: 12be1c744e00 - stable/12 - gvinum: correct assertions
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Thu, 23 Mar 2023 12:50:31 UTC
The branch stable/12 has been updated by emaste:
URL: https://cgit.FreeBSD.org/src/commit/?id=12be1c744e002b96c3b84e816e8ec72455f443bf
commit 12be1c744e002b96c3b84e816e8ec72455f443bf
Author: Ed Maste <emaste@FreeBSD.org>
AuthorDate: 2022-12-12 17:08:39 +0000
Commit: Ed Maste <emaste@FreeBSD.org>
CommitDate: 2023-03-23 12:49:43 +0000
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
(cherry picked from commit 87bb53cb538059a3085db1fa4295dde5fcba55fe)
(cherry picked from commit 66f3ac8c661df02cf7d9e187ea20e66e2e71ec82)
---
sys/geom/vinum/geom_vinum_plex.c | 2 +-
sys/geom/vinum/geom_vinum_raid5.c | 4 ++--
2 files changed, 3 insertions(+), 3 deletions(-)
diff --git a/sys/geom/vinum/geom_vinum_plex.c b/sys/geom/vinum/geom_vinum_plex.c
index 4afdb282b821..fc24938bd372 100644
--- a/sys/geom/vinum/geom_vinum_plex.c
+++ b/sys/geom/vinum/geom_vinum_plex.c
@@ -172,7 +172,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"));
diff --git a/sys/geom/vinum/geom_vinum_raid5.c b/sys/geom/vinum/geom_vinum_raid5.c
index c21e28ac6a72..0655890e2416 100644
--- a/sys/geom/vinum/geom_vinum_raid5.c
+++ b/sys/geom/vinum/geom_vinum_raid5.c
@@ -604,7 +604,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));
@@ -612,7 +612,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)