All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Niklas Söderlund" <niklas.soderlund@ragnatech.se>
To: Dan Carpenter <dan.carpenter@oracle.com>
Cc: linux-media@vger.kernel.org, linux-renesas-soc@vger.kernel.org
Subject: Re: [bug report] media: rcar-vin: add group allocator functions
Date: Thu, 3 May 2018 14:53:00 +0200	[thread overview]
Message-ID: <20180503125300.GB9120@bigcity.dyn.berto.se> (raw)
In-Reply-To: <20180503123630.GA19539@mwanda>

Hi Dan,

Thanks for your report. A proposed fix to this is available [1], 
awaiting inclusion in the media-tree :-)

1. https://patchwork.linuxtv.org/patch/49025/

On 2018-05-03 15:36:30 +0300, Dan Carpenter wrote:
> Hello Niklas Söderlund,
> 
> The patch 3bb4c3bc85bf: "media: rcar-vin: add group allocator
> functions" from Apr 14, 2018, leads to the following static checker
> warning:
> 
> 	drivers/media/platform/rcar-vin/rcar-core.c:346 rvin_group_put()
> 	error: potential NULL dereference 'vin->group'.
> 
> drivers/media/platform/rcar-vin/rcar-core.c
>    339  static void rvin_group_put(struct rvin_dev *vin)
>    340  {
>    341          mutex_lock(&vin->group->lock);
>    342  
>    343          vin->group = NULL;
>                 ^^^^^^^^^^^^^^^^^
> Set to NULL.
> 
>    344          vin->v4l2_dev.mdev = NULL;
>    345  
>    346          if (WARN_ON(vin->group->vin[vin->id] != vin))
>                             ^^^^^^^^^^^^^^^^^^^^^^^^
>    347                  goto out;
>    348  
>    349          vin->group->vin[vin->id] = NULL;
>                 ^^^^^^^^^^^^^^^^^^^^^^^^
>    350  out:
>    351          mutex_unlock(&vin->group->lock);
>                               ^^^^^^^^^^^^^^^^
>    352  
>    353          kref_put(&vin->group->refcount, rvin_group_release);
>                           ^^^^^^^^^^^^^^^^^^^^
> 
> There are a bunch of NULL dereferences here...
> 
>    354  }
> 
> regards,
> dan carpenter

-- 
Regards,
Niklas Söderlund

WARNING: multiple messages have this Message-ID (diff)
From: "Niklas Söderlund" <niklas.soderlund@ragnatech.se>
To: Dan Carpenter <dan.carpenter@oracle.com>
Cc: linux-media@vger.kernel.org, linux-renesas-soc@vger.kernel.org
Subject: Re: [bug report] media: rcar-vin: add group allocator functions
Date: Thu, 3 May 2018 14:53:00 +0200	[thread overview]
Message-ID: <20180503125300.GB9120@bigcity.dyn.berto.se> (raw)
In-Reply-To: <20180503123630.GA19539@mwanda>

Hi Dan,

Thanks for your report. A proposed fix to this is available [1], 
awaiting inclusion in the media-tree :-)

1. https://patchwork.linuxtv.org/patch/49025/

On 2018-05-03 15:36:30 +0300, Dan Carpenter wrote:
> Hello Niklas S�derlund,
> 
> The patch 3bb4c3bc85bf: "media: rcar-vin: add group allocator
> functions" from Apr 14, 2018, leads to the following static checker
> warning:
> 
> 	drivers/media/platform/rcar-vin/rcar-core.c:346 rvin_group_put()
> 	error: potential NULL dereference 'vin->group'.
> 
> drivers/media/platform/rcar-vin/rcar-core.c
>    339  static void rvin_group_put(struct rvin_dev *vin)
>    340  {
>    341          mutex_lock(&vin->group->lock);
>    342  
>    343          vin->group = NULL;
>                 ^^^^^^^^^^^^^^^^^
> Set to NULL.
> 
>    344          vin->v4l2_dev.mdev = NULL;
>    345  
>    346          if (WARN_ON(vin->group->vin[vin->id] != vin))
>                             ^^^^^^^^^^^^^^^^^^^^^^^^
>    347                  goto out;
>    348  
>    349          vin->group->vin[vin->id] = NULL;
>                 ^^^^^^^^^^^^^^^^^^^^^^^^
>    350  out:
>    351          mutex_unlock(&vin->group->lock);
>                               ^^^^^^^^^^^^^^^^
>    352  
>    353          kref_put(&vin->group->refcount, rvin_group_release);
>                           ^^^^^^^^^^^^^^^^^^^^
> 
> There are a bunch of NULL dereferences here...
> 
>    354  }
> 
> regards,
> dan carpenter

-- 
Regards,
Niklas S�derlund

  reply	other threads:[~2018-05-03 12:53 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-05-03 12:36 [bug report] media: rcar-vin: add group allocator functions Dan Carpenter
2018-05-03 12:36 ` Dan Carpenter
2018-05-03 12:53 ` Niklas Söderlund [this message]
2018-05-03 12:53   ` Niklas Söderlund

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=20180503125300.GB9120@bigcity.dyn.berto.se \
    --to=niklas.soderlund@ragnatech.se \
    --cc=dan.carpenter@oracle.com \
    --cc=linux-media@vger.kernel.org \
    --cc=linux-renesas-soc@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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.