Re: [PATCH] genl: fix ‘attr_grp.next_len ’ may be used uninitialized
Denis Kenzior <[email protected]> Tue, 17 Oct 2023 10:08:03 -0500
| Newsgroups | dev.linux.lists.ell |
|---|---|
| Message-ID | <[email protected]> |
Hi Max,
On 10/16/23 13:39, MaxLyubimov wrote:
> 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(-)
>
I added a space between 'Max' and 'Lyubimov' in your author tag. Tell me if
this was incorrect. If it was correct, can you please fix your git config?
> 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))
> {
Something in your mail server is messing with the text format. I had to
manually edit the patch so it would apply properly (by e.g. removing the newline
before this '{'). Please fix that since I can't do this for more than the
simplest patches.
> 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) {
>
>
Applied, thanks.
Regards,
-Denis