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>] [thread-next>] [day] [month] [year] [list]
Message-Id: <20221004101200.758009-1-usama.anjum@collabora.com>
Date:   Tue,  4 Oct 2022 15:11:57 +0500
From:   Muhammad Usama Anjum <usama.anjum@...labora.com>
To:     "K. Y. Srinivasan" <kys@...rosoft.com>,
        Haiyang Zhang <haiyangz@...rosoft.com>,
        Stephen Hemminger <sthemmin@...rosoft.com>,
        Wei Liu <wei.liu@...nel.org>, Dexuan Cui <decui@...rosoft.com>,
        Long Li <longli@...rosoft.com>,
        "David S. Miller" <davem@...emloft.net>,
        Eric Dumazet <edumazet@...gle.com>,
        Jakub Kicinski <kuba@...nel.org>,
        Paolo Abeni <pabeni@...hat.com>,
        Jason Gunthorpe <jgg@...pe.ca>,
        Ajay Sharma <sharmaajay@...rosoft.com>
Cc:     Muhammad Usama Anjum <usama.anjum@...labora.com>,
        kernel@...labora.com, kernel-janitors@...r.kernel.org,
        linux-hyperv@...r.kernel.org, netdev@...r.kernel.org,
        linux-kernel@...r.kernel.org
Subject: [PATCH] net: mana: store return status in signed variable

The mana_adev_idx_alloc() can return negative value. Save its return
value in ret which is signed variable and check if it is correct value.

Fixes: ee928282bfa7 ("net: mana: Add support for auxiliary device")
Signed-off-by: Muhammad Usama Anjum <usama.anjum@...labora.com>
---
 drivers/net/ethernet/microsoft/mana/mana_en.c | 7 +++----
 1 file changed, 3 insertions(+), 4 deletions(-)

diff --git a/drivers/net/ethernet/microsoft/mana/mana_en.c b/drivers/net/ethernet/microsoft/mana/mana_en.c
index 7ca313c7b7b3..1c59502d34b5 100644
--- a/drivers/net/ethernet/microsoft/mana/mana_en.c
+++ b/drivers/net/ethernet/microsoft/mana/mana_en.c
@@ -2203,11 +2203,10 @@ static int add_adev(struct gdma_dev *gd)
 		return -ENOMEM;
 
 	adev = &madev->adev;
-	adev->id = mana_adev_idx_alloc();
-	if (adev->id < 0) {
-		ret = adev->id;
+	ret = mana_adev_idx_alloc();
+	if (ret < 0)
 		goto idx_fail;
-	}
+	adev->id = ret;
 
 	adev->name = "rdma";
 	adev->dev.parent = gd->gdma_context->dev;
-- 
2.30.2

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ