Search Linux Wireless

Re: [PATCH] iwlegacy: Add null pointer check to il_leds_init

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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@xxxxxxxxxxx>
> Signed-off-by: Kunwu Chan <chentao@xxxxxxxxxx>
Acked-by: Stanislaw Gruszka <stf_xl@xxxxx>

> ---
>  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
> 




[Index of Archives]     [Linux Host AP]     [ATH6KL]     [Linux Wireless Personal Area Network]     [Linux Bluetooth]     [Wireless Regulations]     [Linux Netdev]     [Kernel Newbies]     [Linux Kernel]     [IDE]     [Git]     [Netfilter]     [Bugtraq]     [Yosemite Hiking]     [MIPS Linux]     [ARM Linux]     [Linux RAID]

  Powered by Linux