All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] iwlegacy: Add null pointer check to il_leds_init
@ 2023-12-11  3:30 Kunwu Chan
  2023-12-12  3:46 ` Stanislaw Gruszka
  2023-12-12 15:35 ` wifi: iwlegacy: Add null pointer check to il_leds_init() Kalle Valo
  0 siblings, 2 replies; 3+ messages in thread
From: Kunwu Chan @ 2023-12-11  3:30 UTC (permalink / raw)
  To: stf_xl, kvalo; +Cc: linux-wireless, linux-kernel, Kunwu Chan, Kunwu Chan

kasprintf() returns a pointer to dynamically allocated memory
which can be NULL upon failure.

Cc: Kunwu Chan <kunwu.chan@hotmail.com>
Signed-off-by: Kunwu Chan <chentao@kylinos.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


^ permalink raw reply related	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2023-12-12 15:35 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-12-11  3:30 [PATCH] iwlegacy: Add null pointer check to il_leds_init Kunwu Chan
2023-12-12  3:46 ` Stanislaw Gruszka
2023-12-12 15:35 ` wifi: iwlegacy: Add null pointer check to il_leds_init() Kalle Valo

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.