linux-leds.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Jacek Anaszewski <jacek.anaszewski@gmail.com>
To: Oleh Kravchenko <oleg@kaa.org.ua>, linux-leds@vger.kernel.org
Subject: Re: [PATCH] led: triggers: Fix dereferencing of null pointer
Date: Thu, 5 Sep 2019 22:37:55 +0200	[thread overview]
Message-ID: <866fbf2c-ecdf-7e67-40ec-fb06bef31c6e@gmail.com> (raw)
In-Reply-To: <20190903211819.23578-1-oleg@kaa.org.ua>

Hi Oleh,

Thank you for the patch

On 9/3/19 11:18 PM, Oleh Kravchenko wrote:
> Error was detected by PVS-Studio:
> V522 Dereferencing of the null pointer 'led_cdev->trigger' might take place.
> 
> Signed-off-by: Oleh Kravchenko <oleg@kaa.org.ua>
> ---
>  drivers/leds/led-triggers.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/leds/led-triggers.c b/drivers/leds/led-triggers.c
> index eff1bda8b520..23963e5cb5d6 100644
> --- a/drivers/leds/led-triggers.c
> +++ b/drivers/leds/led-triggers.c
> @@ -167,11 +167,11 @@ int led_trigger_set(struct led_classdev *led_cdev, struct led_trigger *trig)
>  		trig->deactivate(led_cdev);
>  err_activate:
>  
> -	led_cdev->trigger = NULL;
> -	led_cdev->trigger_data = NULL;
>  	write_lock_irqsave(&led_cdev->trigger->leddev_list_lock, flags);
>  	list_del(&led_cdev->trig_list);
>  	write_unlock_irqrestore(&led_cdev->trigger->leddev_list_lock, flags);
> +	led_cdev->trigger = NULL;
> +	led_cdev->trigger_data = NULL;
>  	led_set_brightness(led_cdev, LED_OFF);
>  	kfree(event);
>  
> 

Added tag:

Fixes: 2282e125a406 ("leds: triggers: let struct led_trigger::activate()
return an error code")

and applied.

-- 
Best regards,
Jacek Anaszewski

      reply	other threads:[~2019-09-05 20:38 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-09-03 21:18 [PATCH] led: triggers: Fix dereferencing of null pointer Oleh Kravchenko
2019-09-05 20:37 ` Jacek Anaszewski [this message]

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=866fbf2c-ecdf-7e67-40ec-fb06bef31c6e@gmail.com \
    --to=jacek.anaszewski@gmail.com \
    --cc=linux-leds@vger.kernel.org \
    --cc=oleg@kaa.org.ua \
    /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).