diff options
author | Kunwu Chan <[email protected]> | 2023-12-11 11:30:19 +0800 |
---|---|---|
committer | Kalle Valo <[email protected]> | 2023-12-12 17:35:20 +0200 |
commit | afd549903ea98bd21b9db2a409b227e893b7a70f (patch) | |
tree | 82ec00ea8d3b79efbaa5125d91efcb2ea4ad3f1e | |
parent | 0a999d82b782b55626e370ae2006dd51b48923ee (diff) |
wifi: 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 <[email protected]>
Signed-off-by: Kunwu Chan <[email protected]>
Acked-by: Stanislaw Gruszka <[email protected]>
Signed-off-by: Kalle Valo <[email protected]>
Link: https://lore.kernel.org/r/[email protected]
-rw-r--r-- | drivers/net/wireless/intel/iwlegacy/common.c | 3 |
1 files changed, 3 insertions, 0 deletions
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; |