From cd2e908669a869bc4503f0d79402af810c74e982 Mon Sep 17 00:00:00 2001 From: Mark Johnston Date: Wed, 20 Feb 2019 17:07:08 +0000 Subject: [PATCH] Define a constant for the maximum number of GEOM_CTL arguments. Reviewed by: eugen MFC with: r344305 Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D19271 --- sys/geom/geom_ctl.c | 2 +- sys/geom/geom_ctl.h | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/sys/geom/geom_ctl.c b/sys/geom/geom_ctl.c index 0c0087912693..3eddc832f9b4 100644 --- a/sys/geom/geom_ctl.c +++ b/sys/geom/geom_ctl.c @@ -139,7 +139,7 @@ gctl_copyin(struct gctl_req *req) char *p; u_int i; - if (req->narg > 2048) { + if (req->narg > GEOM_CTL_ARG_MAX) { gctl_error(req, "too many arguments"); req->arg = NULL; return; diff --git a/sys/geom/geom_ctl.h b/sys/geom/geom_ctl.h index b7bec250cc40..50153d019247 100644 --- a/sys/geom/geom_ctl.h +++ b/sys/geom/geom_ctl.h @@ -78,7 +78,8 @@ struct gctl_req { #define GEOM_CTL _IOW('G', GCTL_VERSION, struct gctl_req) +#define GEOM_CTL_ARG_MAX 2048 /* maximum number of parameters */ + #define PATH_GEOM_CTL "geom.ctl" - #endif /* _GEOM_GEOM_CTL_H_ */