All of lore.kernel.org
 help / color / mirror / Atom feed
* [bug report] media: rcar-vin: add group allocator functions
@ 2018-05-03 12:36 ` Dan Carpenter
  0 siblings, 0 replies; 4+ messages in thread
From: Dan Carpenter @ 2018-05-03 12:36 UTC (permalink / raw)
  To: niklas.soderlund+renesas; +Cc: linux-media, linux-renesas-soc

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

^ permalink raw reply	[flat|nested] 4+ messages in thread

* [bug report] media: rcar-vin: add group allocator functions
@ 2018-05-03 12:36 ` Dan Carpenter
  0 siblings, 0 replies; 4+ messages in thread
From: Dan Carpenter @ 2018-05-03 12:36 UTC (permalink / raw)
  To: niklas.soderlund+renesas; +Cc: linux-media, linux-renesas-soc

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

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [bug report] media: rcar-vin: add group allocator functions
  2018-05-03 12:36 ` Dan Carpenter
@ 2018-05-03 12:53   ` Niklas Söderlund
  -1 siblings, 0 replies; 4+ messages in thread
From: Niklas Söderlund @ 2018-05-03 12:53 UTC (permalink / raw)
  To: Dan Carpenter; +Cc: linux-media, linux-renesas-soc

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

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [bug report] media: rcar-vin: add group allocator functions
@ 2018-05-03 12:53   ` Niklas Söderlund
  0 siblings, 0 replies; 4+ messages in thread
From: Niklas Söderlund @ 2018-05-03 12:53 UTC (permalink / raw)
  To: Dan Carpenter; +Cc: linux-media, linux-renesas-soc

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

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2018-05-03 12:53 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
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
2018-05-03 12:53   ` Niklas Söderlund

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.