aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMaxim Lyubimov <m.lyubimov@aqsi.ru>2023-10-16 23:39:58 +0500
committerDenis Kenzior <denkenz@gmail.com>2023-10-17 10:24:32 -0500
commiteb139e23abf35ec8bf922fc640aa1292826225a3 (patch)
treef467ae21c5587f4439229eea6c98d9c2e65f2428
parent79f97d9b00485e7ad6f9344fbafeb57957890ccc (diff)
genl: fix ‘attr_grp.next_len’ may be used uninitialized
make --no-print-directory all-am CC ell/genl.lo ell/genl.c: In function ‘parse_cmd_newfamily.part.0’: ell/genl.c:1728:5: error: ‘attr_grp.next_len’ may be used uninitialized in this function [-Werror=maybe-uninitialized] 1728 | if (!NLA_OK(nla, attr->next_len)) | ^ ell/genl.c:268:22: note: ‘attr_grp.next_len’ was declared here 268 | struct l_genl_attr attr_grp; | ^~~~~~~~ ell/genl.c:1732:14: error: ‘attr_grp.next_data’ may be used uninitialized in this function [-Werror=maybe-uninitialized] 1732 | *type = nla->nla_type & NLA_TYPE_MASK; | ~~~^~~~~~~~~~ ell/genl.c:268:22: note: ‘attr_grp.next_data’ was declared here 268 | struct l_genl_attr attr_grp; | ^~~~~~~~ ell/genl.c:1728:5: error: ‘attr_op.next_len’ may be used uninitialized in this function [-Werror=maybe-uninitialized] 1728 | if (!NLA_OK(nla, attr->next_len)) | ^ ell/genl.c:240:22: note: ‘attr_op.next_len’ was declared here 240 | struct l_genl_attr attr_op; | ^~~~~~~ ell/genl.c:1732:14: error: ‘attr_op.next_data’ may be used uninitialized in this function [-Werror=maybe-uninitialized] 1732 | *type = nla->nla_type & NLA_TYPE_MASK; | ~~~^~~~~~~~~~ ell/genl.c:240:22: note: ‘attr_op.next_data’ was declared here 240 | struct l_genl_attr attr_op; | ^~~~~~~ cc1: all warnings being treated as errors make[1]: *** [Makefile:4032: ell/genl.lo] Error 1 make: *** [Makefile:2348: all] Error 2
-rw-r--r--ell/genl.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/ell/genl.c b/ell/genl.c
index def37908..33ecc4d4 100644
--- a/ell/genl.c
+++ b/ell/genl.c
@@ -240,7 +240,8 @@ static void family_ops(struct l_genl_family_info *info,
struct l_genl_attr attr_op;
uint32_t id = 0, flags = 0;
- l_genl_attr_recurse(attr, &attr_op);
+ if (!l_genl_attr_recurse(attr, &attr_op))
+ continue;
while (l_genl_attr_next(&attr_op, &type, &len, &data)) {
switch (type) {
@@ -269,7 +270,8 @@ static void family_mcast_groups(struct l_genl_family_info *info,
const char *name = NULL;
uint32_t id = 0;
- l_genl_attr_recurse(attr, &attr_grp);
+ if (!l_genl_attr_recurse(attr, &attr_grp))
+ continue;
while (l_genl_attr_next(&attr_grp, &type, &len, &data)) {
switch (type) {