linux-wireless.vger.kernel.org archive mirror
 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

* Re: [PATCH] iwlegacy: Add null pointer check to il_leds_init
  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
  1 sibling, 0 replies; 3+ messages in thread
From: Stanislaw Gruszka @ 2023-12-12  3:46 UTC (permalink / raw)
  To: Kunwu Chan; +Cc: kvalo, linux-wireless, linux-kernel, Kunwu Chan

On Mon, Dec 11, 2023 at 11:30:19AM +0800, Kunwu Chan wrote:
> 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>
Acked-by: Stanislaw Gruszka <stf_xl@wp.pl>

> ---
>  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	[flat|nested] 3+ messages in thread

* Re: wifi: iwlegacy: Add null pointer check to il_leds_init()
  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 ` Kalle Valo
  1 sibling, 0 replies; 3+ messages in thread
From: Kalle Valo @ 2023-12-12 15:35 UTC (permalink / raw)
  To: Kunwu Chan; +Cc: stf_xl, linux-wireless, linux-kernel, Kunwu Chan, Kunwu Chan

Kunwu Chan <chentao@kylinos.cn> wrote:

> 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>
> Acked-by: Stanislaw Gruszka <stf_xl@wp.pl>

Patch applied to wireless-next.git, thanks.

afd549903ea9 wifi: iwlegacy: Add null pointer check to il_leds_init()

-- 
https://patchwork.kernel.org/project/linux-wireless/patch/20231211033019.238149-1-chentao@kylinos.cn/

https://wireless.wiki.kernel.org/en/developers/documentation/submittingpatches


^ permalink raw reply	[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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).