mirror of
https://git.kernel.org/pub/scm/network/wireless/iwd.git
synced 2025-03-03 14:20:40 +01:00
monitor: RTNL IFLA flags were printed incorrectly
If flags was 0, then an uninitialized buffer was printed. Changed this so that if flags == 0, then just the value is printed. If flags != 0, then print flags values to a buffer that is big enough to hold all the sub-strings.
This commit is contained in:
parent
e69b21ccdf
commit
7a16f0a263
@ -2621,27 +2621,26 @@ static void ififlags_str(char *str, size_t size, uint16_t flags)
|
||||
{
|
||||
int pos, i;
|
||||
|
||||
if (!str || !flags)
|
||||
pos = sprintf(str, "(0x%02x)", flags);
|
||||
if (!flags)
|
||||
return;
|
||||
|
||||
pos = sprintf(str, "(0x%02x)", flags);
|
||||
pos += sprintf(str + pos, " [");
|
||||
|
||||
for (i = 0; rtnl_flags[i].name; i++) {
|
||||
if (flags & rtnl_flags[i].flag) {
|
||||
flags &= ~rtnl_flags[i].flag;
|
||||
pos += sprintf(str + pos, "%s%c", rtnl_flags[i].name,
|
||||
flags ? ',' : ']');
|
||||
pos += sprintf(str + pos, "%s%s", rtnl_flags[i].name,
|
||||
flags ? "," : "");
|
||||
}
|
||||
}
|
||||
|
||||
if (flags)
|
||||
pos += sprintf(str + pos, "0x%x]", flags);
|
||||
pos += sprintf(str + pos, "]");
|
||||
}
|
||||
|
||||
static void print_ifinfomsg(const struct ifinfomsg *info)
|
||||
{
|
||||
char str[64];
|
||||
char str[256];
|
||||
|
||||
if (!info)
|
||||
return;
|
||||
|
Loading…
x
Reference in New Issue
Block a user