Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 23 Jul 2025 06:22:12 GMT
From:      Warner Losh <imp@FreeBSD.org>
To:        src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org
Subject:   git: f4e7cb535b9c - main - gvirstor: in virstor_ctl_remove() the copy length of the second bcopy might be wrong.
Message-ID:  <202507230622.56N6MCIO020445@gitrepo.freebsd.org>

next in thread | raw e-mail | index | archive | help
The branch main has been updated by imp:

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

commit f4e7cb535b9cb1ddd608b382f29d8123931d5212
Author:     Wuyang Chung <wy-chung@outlook.com>
AuthorDate: 2025-07-12 16:09:36 +0000
Commit:     Warner Losh <imp@FreeBSD.org>
CommitDate: 2025-07-23 06:03:48 +0000

    gvirstor: in virstor_ctl_remove() the copy length of the second bcopy might be wrong.
    
    Reviewed by: imp
    Pull Request: https://github.com/freebsd/freebsd-src/pull/1763
---
 sys/geom/virstor/g_virstor.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/sys/geom/virstor/g_virstor.c b/sys/geom/virstor/g_virstor.c
index b8cf32875660..73bd9f73055a 100644
--- a/sys/geom/virstor/g_virstor.c
+++ b/sys/geom/virstor/g_virstor.c
@@ -589,7 +589,7 @@ virstor_ctl_remove(struct gctl_req *req, struct g_class *cp)
 		    M_GVIRSTOR, M_WAITOK | M_ZERO);
 		bcopy(sc->components, newcomp, found * sizeof(*sc->components));
 		bcopy(&sc->components[found + 1], newcomp + found,
-		    found * sizeof(*sc->components));
+		    (sc->n_components - (found + 1)) * sizeof(*sc->components));
 		if ((sc->components[j].flags & VIRSTOR_PROVIDER_ALLOCATED) != 0) {
 			LOG_MSG(LVL_ERROR, "Allocated provider %s cannot be "
 			    "removed from %s",



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