[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-Id: <20231211033019.238149-1-chentao@kylinos.cn>
Date: Mon, 11 Dec 2023 11:30:19 +0800
From: Kunwu Chan <chentao@...inos.cn>
To: stf_xl@...pl, kvalo@...nel.org
Cc: linux-wireless@...r.kernel.org, linux-kernel@...r.kernel.org,
Kunwu Chan <chentao@...inos.cn>,
Kunwu Chan <kunwu.chan@...mail.com>
Subject: [PATCH] iwlegacy: Add null pointer check to il_leds_init
kasprintf() returns a pointer to dynamically allocated memory
which can be NULL upon failure.
Cc: Kunwu Chan <kunwu.chan@...mail.com>
Signed-off-by: Kunwu Chan <chentao@...inos.cn>
---
drivers/net/wireless/intel/iwlegacy/common.c | 3 +++
1 file changed, 3 insertions(+)
diff --git a/drivers/net/wireless/intel/iwlegacy/common.c b/drivers/net/wireless/intel/iwlegacy/common.c
index 054fef680aba..17570d62c896 100644
--- a/drivers/net/wireless/intel/iwlegacy/common.c
+++ b/drivers/net/wireless/intel/iwlegacy/common.c
@@ -541,6 +541,9 @@ il_leds_init(struct il_priv *il)
il->led.name =
kasprintf(GFP_KERNEL, "%s-led", wiphy_name(il->hw->wiphy));
+ if (!il->led.name)
+ return;
+
il->led.brightness_set = il_led_brightness_set;
il->led.blink_set = il_led_blink_set;
il->led.max_brightness = 1;
--
2.39.2
Powered by blists - more mailing lists