]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
BUG/MINOR: stats: replace objt_* by __objt_* macros
authorAmaury Denoyelle <adenoyelle@haproxy.com>
Mon, 29 Apr 2024 12:16:19 +0000 (14:16 +0200)
committerAmaury Denoyelle <adenoyelle@haproxy.com>
Mon, 29 Apr 2024 12:21:10 +0000 (14:21 +0200)
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.

src/stats-file.c

index 2706dbff14c774fa4ed8033f2868e69f3de99f69..a41df828f4f6528e1af1ac072e65e8dfbc449587 100644 (file)
@@ -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;