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.
This commit is contained in:
Amaury Denoyelle 2024-04-29 14:16:19 +02:00
parent 83639edd24
commit 20bc42e697

View 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;