($INBOX_DIR/description missing)
 help / color / mirror / Atom feed
From: MaxLyubimov <m.lyubimov@aqsi.ru>
To: ell@lists.linux.dev
Subject: [PATCH] genl: fix ‘attr_grp.next_len’ may be used uninitialized
Date: Mon, 16 Oct 2023 23:39:58 +0500	[thread overview]
Message-ID: <4103d54928605fb3d2a573ba6890395b4a155138.camel@aqsi.ru> (raw)

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
---
 ell/genl.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/ell/genl.c b/ell/genl.c
index def3790..33ecc4d 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) {


             reply	other threads:[~2023-10-16 19:16 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-10-16 18:39 MaxLyubimov [this message]
2023-10-17 15:08 ` [PATCH] genl: fix ‘attr_grp.next_len’ may be used uninitialized Denis Kenzior
2023-10-17 15:21   ` Lyubimov Maxim
2023-10-17 15:26     ` Denis Kenzior
2023-10-17 16:43       ` Lyubimov Maxim

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=4103d54928605fb3d2a573ba6890395b4a155138.camel@aqsi.ru \
    --to=m.lyubimov@aqsi.ru \
    --cc=ell@lists.linux.dev \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).