diff mbox series

genl: fix ‘attr_grp.next_len’ may be used uninitialized

Message ID 4103d54928605fb3d2a573ba6890395b4a155138.camel@aqsi.ru (mailing list archive)
State New
Headers show
Series genl: fix ‘attr_grp.next_len’ may be used uninitialized | expand

Checks

Context Check Description
tedd_an/pre-ci_am fail error: patch fragment without header at line 7: @@ -269,7 +270,8 @@ static void family_mcast_groups(struct hint: Use 'git am --show-current-patch' to see the failed patch

Commit Message

Maxim Lyubimov Oct. 16, 2023, 6:39 p.m. UTC
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(-)

{
 			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) {

Comments

Denis Kenzior Oct. 17, 2023, 3:08 p.m. UTC | #1
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
Maxim Lyubimov Oct. 17, 2023, 3:21 p.m. UTC | #2
Hello Denis

On 17/10/2023 в 10:08 -0500, Denis Kenzior wrote:
> 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?

Lyubimov Maxim. Okay, I'll fix the 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.

I wanted to ask what git-send-email configuration should be used to
send patches correctly?

> >   			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

Best regards,
Lyubimov Maxim
Denis Kenzior Oct. 17, 2023, 3:26 p.m. UTC | #3
Hi Maxim,

> 
> Lyubimov Maxim. Okay, I'll fix the config.
> 

Ok, I force-pushed an update with Author: Maxim Lyubimov <m.lyubimov@aqsi.ru>

>> 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.
> 
> I wanted to ask what git-send-email configuration should be used to
> send patches correctly?

I'm not aware of any special git-send-email configuration.  Mine is simply:

[sendemail]
        smtpencryption = tls
        smtpserver = smtp.gmail.com
        smtpuser = denkenz@gmail.com
        smtpserverport = 587

It may be the outgoing mail server you're using is doing something 'smart'.

Regards,
-Denis
Maxim Lyubimov Oct. 17, 2023, 4:43 p.m. UTC | #4
> I'm not aware of any special git-send-email configuration.  Mine is
> simply:
> 
> [sendemail]
>         smtpencryption = tls
>         smtpserver = smtp.gmail.com
>         smtpuser = ***@gmail.com
>         smtpserverport = 587
> 
> It may be the outgoing mail server you're using is doing something
> 'smart'.
> 

Thanks, I have almost the same thing, only smtpencryption = ssl, the
problem was that this patch was sent via Evolution, I hope there are no
similar problems in the patches for ofono, I sent them via git-send-
email.
diff mbox series

Patch

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))