From: Amaury Denoyelle Date: Mon, 29 Apr 2024 12:16:19 +0000 (+0200) Subject: BUG/MINOR: stats: replace objt_* by __objt_* macros X-Git-Tag: v3.0-dev10~45 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=20bc42e69722bb129c62fc2450a4a6757250ee0a;p=thirdparty%2Fhaproxy.git BUG/MINOR: stats: replace objt_* by __objt_* macros Update parse_stat_line() used during stats-file parsing. For each line, GUID is extracted first to access to the object instance. obj_type() is then invoked to retrieve the correct object type. Replace objt_* by __objt_* macros to mark its result as safe and non NULL. This should fix coverity report from github issue #2550. No need to backport. --- diff --git a/src/stats-file.c b/src/stats-file.c index 2706dbff14..a41df828f4 100644 --- a/src/stats-file.c +++ b/src/stats-file.c @@ -220,7 +220,7 @@ static int parse_stat_line(struct ist line, switch (obj_type(node->obj_type)) { case OBJ_TYPE_PROXY: - px = objt_proxy(node->obj_type); + px = __objt_proxy(node->obj_type); if (domain == STFILE_DOMAIN_PX_FE) { if (!(px->cap & PR_CAP_FE)) @@ -244,7 +244,7 @@ static int parse_stat_line(struct ist line, if (domain != STFILE_DOMAIN_PX_FE) goto err; - li = objt_listener(node->obj_type); + li = __objt_listener(node->obj_type); /* Listeners counters are not allocated if 'option socket-stats' unset. */ if (!li->counters) return 0; @@ -257,7 +257,7 @@ static int parse_stat_line(struct ist line, if (domain != STFILE_DOMAIN_PX_BE) goto err; - srv = objt_server(node->obj_type); + srv = __objt_server(node->obj_type); base_off = (char *)&srv->counters; off = 1; break;