netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH net] qlcnic: fix a return in qlcnic_dcb_get_capability()
@ 2018-10-19 20:11 Dan Carpenter
  2018-10-23  2:34 ` David Miller
  0 siblings, 1 reply; 2+ messages in thread
From: Dan Carpenter @ 2018-10-19 20:11 UTC (permalink / raw)
  To: Shahed Shaikh, Sucheta Chakraborty
  Cc: Manish Chopra, Dept-GELinuxNICDev, David S. Miller, netdev,
	kernel-janitors

These functions are supposed to return one on failure and zero on
success.  Returning a zero here could cause uninitialized variable
bugs in several of the callers.  For example:

    drivers/scsi/cxgbi/cxgb4i/cxgb4i.c:1660 get_iscsi_dcb_priority()
    error: uninitialized symbol 'caps'.

Fixes: 48365e485275 ("qlcnic: dcb: Add support for CEE Netlink interface.")
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
---
 drivers/net/ethernet/qlogic/qlcnic/qlcnic_dcb.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/net/ethernet/qlogic/qlcnic/qlcnic_dcb.c b/drivers/net/ethernet/qlogic/qlcnic/qlcnic_dcb.c
index 4b76c69fe86d..834208e55f7b 100644
--- a/drivers/net/ethernet/qlogic/qlcnic/qlcnic_dcb.c
+++ b/drivers/net/ethernet/qlogic/qlcnic/qlcnic_dcb.c
@@ -883,7 +883,7 @@ static u8 qlcnic_dcb_get_capability(struct net_device *netdev, int capid,
 	struct qlcnic_adapter *adapter = netdev_priv(netdev);
 
 	if (!test_bit(QLCNIC_DCB_STATE, &adapter->dcb->state))
-		return 0;
+		return 1;
 
 	switch (capid) {
 	case DCB_CAP_ATTR_PG:
-- 
2.11.0

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

* Re: [PATCH net] qlcnic: fix a return in qlcnic_dcb_get_capability()
  2018-10-19 20:11 [PATCH net] qlcnic: fix a return in qlcnic_dcb_get_capability() Dan Carpenter
@ 2018-10-23  2:34 ` David Miller
  0 siblings, 0 replies; 2+ messages in thread
From: David Miller @ 2018-10-23  2:34 UTC (permalink / raw)
  To: dan.carpenter
  Cc: Shahed.Shaikh, sucheta.chakraborty, manish.chopra,
	Dept-GELinuxNICDev, netdev, kernel-janitors

From: Dan Carpenter <dan.carpenter@oracle.com>
Date: Fri, 19 Oct 2018 23:11:11 +0300

> These functions are supposed to return one on failure and zero on
> success.  Returning a zero here could cause uninitialized variable
> bugs in several of the callers.  For example:
> 
>     drivers/scsi/cxgbi/cxgb4i/cxgb4i.c:1660 get_iscsi_dcb_priority()
>     error: uninitialized symbol 'caps'.
> 
> Fixes: 48365e485275 ("qlcnic: dcb: Add support for CEE Netlink interface.")
> Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>

Applied.

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

end of thread, other threads:[~2018-10-23 10:56 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-10-19 20:11 [PATCH net] qlcnic: fix a return in qlcnic_dcb_get_capability() Dan Carpenter
2018-10-23  2:34 ` 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).