lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite for Android: free password hash cracker in your pocket
[<prev] [next>] [day] [month] [year] [list]
Message-Id: <20190124162700.19989-1-natechancellor@gmail.com>
Date:   Thu, 24 Jan 2019 09:27:00 -0700
From:   Nathan Chancellor <natechancellor@...il.com>
To:     Ariel Elior <Ariel.Elior@...ium.com>, everest-linux-l2@...ium.com,
        "David S. Miller" <davem@...emloft.net>
Cc:     Tomer Tayar <tomer.tayar@...ium.com>,
        Michal Kalderon <michal.kalderon@...ium.com>,
        netdev@...r.kernel.org, linux-kernel@...r.kernel.org,
        Nathan Chancellor <natechancellor@...il.com>
Subject: [PATCH] qede: Don't implicitly cast enumerated types in __qede_probe

Clang warns:

drivers/net/ethernet/qlogic/qede/qede_main.c:1183:29: warning: implicit
conversion from enumeration type 'enum qede_rdma_probe_mode' to
different enumeration type 'enum qede_rdma_remove_mode'
[-Wenum-conversion]
        qede_rdma_dev_remove(edev, QEDE_RDMA_PROBE_MODE(mode));
        ~~~~~~~~~~~~~~~~~~~~       ^~~~~~~~~~~~~~~~~~~~~~~~~~
drivers/net/ethernet/qlogic/qede/qede_main.c:1074:33: note: expanded
from macro 'QEDE_RDMA_PROBE_MODE'
        ((mode) == QEDE_PROBE_NORMAL ? QEDE_RDMA_PROBE_NORMAL \
                                       ^~~~~~~~~~~~~~~~~~~~~~
drivers/net/ethernet/qlogic/qede/qede_main.c:1183:29: warning: implicit
conversion from enumeration type 'enum qede_rdma_probe_mode' to
different enumeration type 'enum qede_rdma_remove_mode'
[-Wenum-conversion]
        qede_rdma_dev_remove(edev, QEDE_RDMA_PROBE_MODE(mode));
        ~~~~~~~~~~~~~~~~~~~~       ^~~~~~~~~~~~~~~~~~~~~~~~~~
drivers/net/ethernet/qlogic/qede/qede_main.c:1075:12: note: expanded
from macro 'QEDE_RDMA_PROBE_MODE'
                                     : QEDE_RDMA_PROBE_RECOVERY)
                                       ^~~~~~~~~~~~~~~~~~~~~~~~
2 warnings generated.

qede_rdma_dev_remove expects an value from enumerated type
qede_rdma_remove_mode. Hoist the definitions of qede_remove_mode
and QEDE_RDMA_REMOVE_MODE up above __qede_probe so they can be
used there, eliminating this warning.

Fixes: 278396de78a9 ("qede: Error recovery process")
Signed-off-by: Nathan Chancellor <natechancellor@...il.com>
---
 drivers/net/ethernet/qlogic/qede/qede_main.c | 20 ++++++++++----------
 1 file changed, 10 insertions(+), 10 deletions(-)

diff --git a/drivers/net/ethernet/qlogic/qede/qede_main.c b/drivers/net/ethernet/qlogic/qede/qede_main.c
index de955f2b2980..06bdba90d521 100644
--- a/drivers/net/ethernet/qlogic/qede/qede_main.c
+++ b/drivers/net/ethernet/qlogic/qede/qede_main.c
@@ -1074,6 +1074,15 @@ enum qede_probe_mode {
 	((mode) == QEDE_PROBE_NORMAL ? QEDE_RDMA_PROBE_NORMAL \
 				     : QEDE_RDMA_PROBE_RECOVERY)
 
+enum qede_remove_mode {
+	QEDE_REMOVE_NORMAL,
+	QEDE_REMOVE_RECOVERY,
+};
+
+#define QEDE_RDMA_REMOVE_MODE(mode) \
+	((mode) == QEDE_REMOVE_NORMAL ? QEDE_RDMA_REMOVE_NORMAL \
+				      : QEDE_RDMA_REMOVE_RECOVERY)
+
 static int __qede_probe(struct pci_dev *pdev, u32 dp_module, u8 dp_level,
 			bool is_vf, enum qede_probe_mode mode)
 {
@@ -1180,7 +1189,7 @@ static int __qede_probe(struct pci_dev *pdev, u32 dp_module, u8 dp_level,
 	return 0;
 
 err4:
-	qede_rdma_dev_remove(edev, QEDE_RDMA_PROBE_MODE(mode));
+	qede_rdma_dev_remove(edev, QEDE_RDMA_REMOVE_MODE(mode));
 err3:
 	free_netdev(edev->ndev);
 err2:
@@ -1214,15 +1223,6 @@ static int qede_probe(struct pci_dev *pdev, const struct pci_device_id *id)
 			    QEDE_PROBE_NORMAL);
 }
 
-enum qede_remove_mode {
-	QEDE_REMOVE_NORMAL,
-	QEDE_REMOVE_RECOVERY,
-};
-
-#define QEDE_RDMA_REMOVE_MODE(mode) \
-	((mode) == QEDE_REMOVE_NORMAL ? QEDE_RDMA_REMOVE_NORMAL \
-			      : QEDE_RDMA_REMOVE_RECOVERY)
-
 static void __qede_remove(struct pci_dev *pdev, enum qede_remove_mode mode)
 {
 	struct net_device *ndev = pci_get_drvdata(pdev);
-- 
2.20.1

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ