You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When building idxd-config on ClearLinux I noticed some warnings when using gcc-13
Tool chain: gcc 13.2.1
The build flags that trigger this are: CC=gcc-13 CFLAGS="-Wformat-security -O3" ./configure
seems that the -O3 flag triggers more code analysis and triggers the warnings
libaccfg.c: In function 'accfg_group_set_traffic_class_a':
libaccfg.c:1736:48: warning: '%s' directive argument is null [-Wformat-overflow=]
1736 | rc = sprintf(group->group_buf, "%s/%s", \
| ^~~~~~~
libaccfg.c:1762:1: note: in expansion of macro 'accfg_group_set_field'
1762 | accfg_group_set_field(group, val, traffic_class_a)
| ^~~~~~~~~~~~~~~~~~~~~
libaccfg.c:1736:52: note: format string is defined here
1736 | rc = sprintf(group->group_buf, "%s/%s", \
| ^~
libaccfg.c: In function 'accfg_group_set_traffic_class_b':
libaccfg.c:1736:48: warning: '%s' directive argument is null [-Wformat-overflow=]
1736 | rc = sprintf(group->group_buf, "%s/%s", \
| ^~~~~~~
libaccfg.c:1763:1: note: in expansion of macro 'accfg_group_set_field'
1763 | accfg_group_set_field(group, val, traffic_class_b)
| ^~~~~~~~~~~~~~~~~~~~~
libaccfg.c:1736:52: note: format string is defined here
1736 | rc = sprintf(group->group_buf, "%s/%s", \
| ^~
libaccfg.c: In function 'accfg_group_set_desc_progress_limit':
libaccfg.c:1736:48: warning: '%s' directive argument is null [-Wformat-overflow=]
1736 | rc = sprintf(group->group_buf, "%s/%s", \
| ^~~~~~~
libaccfg.c:1764:1: note: in expansion of macro 'accfg_group_set_field'
1764 | accfg_group_set_field(group, val, desc_progress_limit)
| ^~~~~~~~~~~~~~~~~~~~~
libaccfg.c:1736:52: note: format string is defined here
1736 | rc = sprintf(group->group_buf, "%s/%s", \
| ^~
libaccfg.c: In function 'accfg_group_set_batch_progress_limit':
libaccfg.c:1736:48: warning: '%s' directive argument is null [-Wformat-overflow=]
1736 | rc = sprintf(group->group_buf, "%s/%s", \
| ^~~~~~~
libaccfg.c:1765:1: note: in expansion of macro 'accfg_group_set_field'
1765 | accfg_group_set_field(group, val, batch_progress_limit)
| ^~~~~~~~~~~~~~~~~~~~~
libaccfg.c:1736:52: note: format string is defined here
1736 | rc = sprintf(group->group_buf, "%s/%s", \
The reason for this is that deprecated_attr() can potentially return NULL (which it probably doesn't but the compiler believes it's a possibility):
static const char *deprecated_attr(char *attr)
{
int i;
for (i = 0; i < (int) ARRAY_SIZE(attr_dict); i++)
if (!strcmp(attr, attr_dict[i].key))
return attr_dict[i].val;
return NULL;
}
I guess NULL could be replaced with a known invalid string instead, or "".
The text was updated successfully, but these errors were encountered:
Hi,
When building idxd-config on ClearLinux I noticed some warnings when using gcc-13
Tool chain: gcc 13.2.1
The build flags that trigger this are:
CC=gcc-13 CFLAGS="-Wformat-security -O3" ./configure
seems that the -O3 flag triggers more code analysis and triggers the warnings
The reason for this is that deprecated_attr() can potentially return NULL (which it probably doesn't but the compiler believes it's a possibility):
I guess NULL could be replaced with a known invalid string instead, or "".
The text was updated successfully, but these errors were encountered: