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>] [thread-next>] [day] [month] [year] [list]
Message-ID: <20240828061941.8173-1-hanchunchao@inspur.com>
Date: Wed, 28 Aug 2024 14:19:41 +0800
From: Charles Han <hanchunchao@...pur.com>
To: <m.grzeschik@...gutronix.de>, <davem@...emloft.net>,
	<edumazet@...gle.com>, <kuba@...nel.org>, <pabeni@...hat.com>
CC: <netdev@...r.kernel.org>, <linux-kernel@...r.kernel.org>,
	<liuyanming@...system.com>, Charles Han <hanchunchao@...pur.com>
Subject: [PATCH] arcnet: com20020-pci:Check devm_kasprintf() returned value

devm_kasprintf() can return a NULL pointer on failure but this returned
value is not checked.

Fix this lack and check the returned value.

Fixes: 8890624a4e8c ("arcnet: com20020-pci: add led trigger support")
Signed-off-by: Charles Han <hanchunchao@...pur.com>
---
 drivers/net/arcnet/com20020-pci.c | 9 +++++++++
 1 file changed, 9 insertions(+)

diff --git a/drivers/net/arcnet/com20020-pci.c b/drivers/net/arcnet/com20020-pci.c
index c5e571ec94c9..ca393f9658e9 100644
--- a/drivers/net/arcnet/com20020-pci.c
+++ b/drivers/net/arcnet/com20020-pci.c
@@ -254,6 +254,10 @@ static int com20020pci_probe(struct pci_dev *pdev,
 			card->tx_led.name = devm_kasprintf(&pdev->dev, GFP_KERNEL,
 							"pci:green:tx:%d-%d",
 							dev->dev_id, i);
+			if (!card->tx_led.default_trigger || !card->tx_led.name) {
+				ret = -ENOMEM;
+				goto err_free_arcdev;
+			}
 
 			card->tx_led.dev = &dev->dev;
 			card->recon_led.brightness_set = led_recon_set;
@@ -263,6 +267,11 @@ static int com20020pci_probe(struct pci_dev *pdev,
 			card->recon_led.name = devm_kasprintf(&pdev->dev, GFP_KERNEL,
 							"pci:red:recon:%d-%d",
 							dev->dev_id, i);
+			if (!card->recon_led.default_trigger || !card->recon_led.name) {
+				ret = -ENOMEM;
+				goto err_free_arcdev;
+			}
+
 			card->recon_led.dev = &dev->dev;
 
 			ret = devm_led_classdev_register(&pdev->dev, &card->tx_led);
-- 
2.31.1


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ