linux-wireless.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Stanislaw Gruszka <stf_xl@wp.pl>
To: Kunwu Chan <chentao@kylinos.cn>
Cc: kvalo@kernel.org, linux-wireless@vger.kernel.org,
	linux-kernel@vger.kernel.org, Kunwu Chan <kunwu.chan@hotmail.com>
Subject: Re: [PATCH] iwlegacy: Add null pointer check to il_leds_init
Date: Tue, 12 Dec 2023 04:46:29 +0100	[thread overview]
Message-ID: <20231212034629.GA24323@wp.pl> (raw)
In-Reply-To: <20231211033019.238149-1-chentao@kylinos.cn>

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
> 

  reply	other threads:[~2023-12-12  3:46 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-12-11  3:30 [PATCH] iwlegacy: Add null pointer check to il_leds_init Kunwu Chan
2023-12-12  3:46 ` Stanislaw Gruszka [this message]
2023-12-12 15:35 ` wifi: iwlegacy: Add null pointer check to il_leds_init() Kalle Valo

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20231212034629.GA24323@wp.pl \
    --to=stf_xl@wp.pl \
    --cc=chentao@kylinos.cn \
    --cc=kunwu.chan@hotmail.com \
    --cc=kvalo@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-wireless@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).