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: <20240929023721.17338-1-hanchunchao@inspur.com>
Date: Sun, 29 Sep 2024 10:37:21 +0800
From: Charles Han <hanchunchao@...pur.com>
To: <m.grzeschik@...gutronix.de>, <davem@...emloft.net>
CC: <edumazet@...gle.com>, <kuba@...nel.org>, <pabeni@...hat.com>,
	<netdev@...r.kernel.org>, <linux-kernel@...r.kernel.org>, Charles Han
	<hanchunchao@...pur.com>
Subject: [PATCH] arcnet: com20020-pci: Add check devm_kasprintf() returned value

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

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

diff --git a/drivers/net/arcnet/com20020-pci.c b/drivers/net/arcnet/com20020-pci.c
index c5e571ec94c9..6639ee11a7f8 100644
--- a/drivers/net/arcnet/com20020-pci.c
+++ b/drivers/net/arcnet/com20020-pci.c
@@ -254,6 +254,8 @@ 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)
+				return -ENOMEM;
 
 			card->tx_led.dev = &dev->dev;
 			card->recon_led.brightness_set = led_recon_set;
@@ -263,6 +265,9 @@ 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)
+				return -ENOMEM;
+
 			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