Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 23 Mar 2023 12:42:22 GMT
From:      Ed Maste <emaste@FreeBSD.org>
To:        src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org
Subject:   git: 66f3ac8c661d - stable/13 - gvinum: correct assertions
Message-ID:  <202303231242.32NCgMJt012406@gitrepo.freebsd.org>

next in thread | raw e-mail | index | archive | help
The branch stable/13 has been updated by emaste:

URL: https://cgit.FreeBSD.org/src/commit/?id=66f3ac8c661df02cf7d9e187ea20e66e2e71ec82

commit 66f3ac8c661df02cf7d9e187ea20e66e2e71ec82
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:41:35 +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)
---
 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 3e5b2e3d51a3..f3895f5b80ff 100644
--- a/sys/geom/vinum/geom_vinum_plex.c
+++ b/sys/geom/vinum/geom_vinum_plex.c
@@ -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"));
diff --git a/sys/geom/vinum/geom_vinum_raid5.c b/sys/geom/vinum/geom_vinum_raid5.c
index 2778646467e2..1c30834ec298 100644
--- a/sys/geom/vinum/geom_vinum_raid5.c
+++ b/sys/geom/vinum/geom_vinum_raid5.c
@@ -605,7 +605,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));
@@ -613,7 +613,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)



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?202303231242.32NCgMJt012406>