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: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [day] [month] [year] [list]
Message-ID: <20220907081642.6599-1-liubo03@inspur.com>
Date:   Wed, 7 Sep 2022 04:16:42 -0400
From:   Bo Liu <liubo03@...pur.com>
To:     <jk@...abs.org>, <joel@....id.au>, <alistair@...ple.id.au>,
        <eajames@...ux.ibm.com>
CC:     <linux-fsi@...ts.ozlabs.org>, <linux-kernel@...r.kernel.org>,
        Bo Liu <liubo03@...pur.com>
Subject: [PATCH] fsi: check ida_simple_get() return value

As ida_simple_get() can fail, we should check the return value.

Signed-off-by: Bo Liu <liubo03@...pur.com>
---
 drivers/fsi/fsi-core.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/drivers/fsi/fsi-core.c b/drivers/fsi/fsi-core.c
index 0d11a17c53a0..c009c9b30ba1 100644
--- a/drivers/fsi/fsi-core.c
+++ b/drivers/fsi/fsi-core.c
@@ -1313,7 +1313,10 @@ int fsi_master_register(struct fsi_master *master)
 	struct device_node *np;
 
 	mutex_init(&master->scan_lock);
-	master->idx = ida_simple_get(&master_ida, 0, INT_MAX, GFP_KERNEL);
+	rc = ida_simple_get(&master_ida, 0, INT_MAX, GFP_KERNEL);
+	if (rc < 0)
+		return rc;
+	master->idx = rc;
 	dev_set_name(&master->dev, "fsi%d", master->idx);
 	master->dev.class = &fsi_master_class;
 
-- 
2.27.0

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ