netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [bug report] dcbnl: Shorten all command handling functions
@ 2020-02-25  7:14 Dan Carpenter
  2020-02-25 18:37 ` David Miller
  0 siblings, 1 reply; 2+ messages in thread
From: Dan Carpenter @ 2020-02-25  7:14 UTC (permalink / raw)
  To: netdev; +Cc: tgraf

The patch 7be994138b18: "dcbnl: Shorten all command handling
functions" from Jun 13, 2012, leads to the following static checker
warning:

	net/dcb/dcbnl.c:1509 dcbnl_ieee_set()
	warn: passing signed to unsigned: 'err'

net/dcb/dcbnl.c
  1491                                  continue;
  1492  
  1493                          if (nla_len(attr) < sizeof(struct dcb_app)) {
  1494                                  err = -ERANGE;
  1495                                  goto err;
  1496                          }
  1497  
  1498                          app_data = nla_data(attr);
  1499                          if (ops->ieee_setapp)
  1500                                  err = ops->ieee_setapp(netdev, app_data);
  1501                          else
  1502                                  err = dcb_ieee_setapp(netdev, app_data);
  1503                          if (err)
  1504                                  goto err;

"err" is negative error codes.

  1505                  }
  1506          }
  1507  
  1508  err:
  1509          err = nla_put_u8(skb, DCB_ATTR_IEEE, err);
                ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
It's not clear what this is doing but it truncates "err" to a u8 and
sets err to zero.

  1510          dcbnl_ieee_notify(netdev, RTM_SETDCB, DCB_CMD_IEEE_SET, seq, 0);
  1511          return err;
  1512  }

There is a similar one at the end of dcbnl_ieee_del() as well.  I've no
idea how to fix this.

regards,
dan carpenter

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [bug report] dcbnl: Shorten all command handling functions
  2020-02-25  7:14 [bug report] dcbnl: Shorten all command handling functions Dan Carpenter
@ 2020-02-25 18:37 ` David Miller
  0 siblings, 0 replies; 2+ messages in thread
From: David Miller @ 2020-02-25 18:37 UTC (permalink / raw)
  To: dan.carpenter; +Cc: netdev, tgraf

From: Dan Carpenter <dan.carpenter@oracle.com>
Date: Tue, 25 Feb 2020 10:14:08 +0300

> The patch 7be994138b18: "dcbnl: Shorten all command handling
> functions" from Jun 13, 2012, leads to the following static checker
> warning:
> 
> 	net/dcb/dcbnl.c:1509 dcbnl_ieee_set()
> 	warn: passing signed to unsigned: 'err'

The problem exists before this commit, it's just that the u8 truncated
'err' is passed into dcbnl_reply().

Yeah this is quite a mess.

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2020-02-25 18:37 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-02-25  7:14 [bug report] dcbnl: Shorten all command handling functions Dan Carpenter
2020-02-25 18:37 ` David Miller

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 NNTP newsgroup(s).