* [PATCH] [media] v4l2-ioctl.c: fix warning due wrong check in v4l_cropcap()
@ 2016-06-14 20:18 Javier Martinez Canillas
2016-06-15 6:09 ` Hans Verkuil
0 siblings, 1 reply; 3+ messages in thread
From: Javier Martinez Canillas @ 2016-06-14 20:18 UTC (permalink / raw)
To: linux-kernel
Cc: Mauro Carvalho Chehab, Hans Verkuil, linux-media,
Javier Martinez Canillas
Commit 95dd7b7e30f3 ("[media] v4l2-ioctl.c: improve cropcap compatibility
code") tried to check if both .vidioc_cropcap and .vidioc_g_selection are
NULL ops and warn if that was the case, but unfortunately the logic isn't
correct and instead checks for .vidioc_cropcap == NULL twice.
So the v4l2 core will print the following warning if a driver has the ops
.vidioc_g_selection set but no .vidioc_cropcap callback:
WARNING: CPU: 2 PID: 4058 at drivers/media/v4l2-core/v4l2-ioctl.c:2174 v4l_cropcap+0x188/0x198 [videodev]
[<c010e1ac>] (unwind_backtrace) from [<c010af38>] (show_stack+0x10/0x14)
[<c010af38>] (show_stack) from [<c032481c>] (dump_stack+0x88/0x9c)
[<c032481c>] (dump_stack) from [<c011a82c>] (__warn+0xe8/0x100)
[<c011a82c>] (__warn) from [<c011a8f4>] (warn_slowpath_null+0x20/0x28)
[<c011a8f4>] (warn_slowpath_null) from [<bf04a9ec>] (v4l_cropcap+0x188/0x198 [videodev])
[<bf04a9ec>] (v4l_cropcap [videodev]) from [<bf04c728>] (__video_do_ioctl+0x298/0x30c [videodev])
[<bf04c728>] (__video_do_ioctl [videodev]) from [<bf04c110>] (video_usercopy+0x174/0x4e8 [videodev])
[<bf04c110>] (video_usercopy [videodev]) from [<bf0475c8>] (v4l2_ioctl+0xc4/0xd8 [videodev])
[<bf0475c8>] (v4l2_ioctl [videodev]) from [<c01efa78>] (do_vfs_ioctl+0x9c/0x8e4)
[<c01efa78>] (do_vfs_ioctl) from [<c01f02f4>] (SyS_ioctl+0x34/0x5c)
[<c01f02f4>] (SyS_ioctl) from [<c01078c0>] (ret_fast_syscall+0x0/0x3c)
Fixes: 95dd7b7e30f3 ("[media] v4l2-ioctl.c: improve cropcap compatibility code")
Signed-off-by: Javier Martinez Canillas <javier@osg.samsung.com>
---
drivers/media/v4l2-core/v4l2-ioctl.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/media/v4l2-core/v4l2-ioctl.c b/drivers/media/v4l2-core/v4l2-ioctl.c
index 28e5be2c2eef..528390f33b53 100644
--- a/drivers/media/v4l2-core/v4l2-ioctl.c
+++ b/drivers/media/v4l2-core/v4l2-ioctl.c
@@ -2171,7 +2171,7 @@ static int v4l_cropcap(const struct v4l2_ioctl_ops *ops,
* The determine_valid_ioctls() call already should ensure
* that this can never happen, but just in case...
*/
- if (WARN_ON(!ops->vidioc_cropcap && !ops->vidioc_cropcap))
+ if (WARN_ON(!ops->vidioc_cropcap && !ops->vidioc_g_selection))
return -ENOTTY;
if (ops->vidioc_cropcap)
--
2.5.5
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH] [media] v4l2-ioctl.c: fix warning due wrong check in v4l_cropcap()
2016-06-14 20:18 [PATCH] [media] v4l2-ioctl.c: fix warning due wrong check in v4l_cropcap() Javier Martinez Canillas
@ 2016-06-15 6:09 ` Hans Verkuil
2016-06-15 12:09 ` Javier Martinez Canillas
0 siblings, 1 reply; 3+ messages in thread
From: Hans Verkuil @ 2016-06-15 6:09 UTC (permalink / raw)
To: Javier Martinez Canillas, linux-kernel; +Cc: Mauro Carvalho Chehab, linux-media
On 06/14/2016 10:18 PM, Javier Martinez Canillas wrote:
> Commit 95dd7b7e30f3 ("[media] v4l2-ioctl.c: improve cropcap compatibility
> code") tried to check if both .vidioc_cropcap and .vidioc_g_selection are
> NULL ops and warn if that was the case, but unfortunately the logic isn't
> correct and instead checks for .vidioc_cropcap == NULL twice.
>
> So the v4l2 core will print the following warning if a driver has the ops
> .vidioc_g_selection set but no .vidioc_cropcap callback:
This fix is already queued up for 4.7.
Regards,
Hans
>
> WARNING: CPU: 2 PID: 4058 at drivers/media/v4l2-core/v4l2-ioctl.c:2174 v4l_cropcap+0x188/0x198 [videodev]
> [<c010e1ac>] (unwind_backtrace) from [<c010af38>] (show_stack+0x10/0x14)
> [<c010af38>] (show_stack) from [<c032481c>] (dump_stack+0x88/0x9c)
> [<c032481c>] (dump_stack) from [<c011a82c>] (__warn+0xe8/0x100)
> [<c011a82c>] (__warn) from [<c011a8f4>] (warn_slowpath_null+0x20/0x28)
> [<c011a8f4>] (warn_slowpath_null) from [<bf04a9ec>] (v4l_cropcap+0x188/0x198 [videodev])
> [<bf04a9ec>] (v4l_cropcap [videodev]) from [<bf04c728>] (__video_do_ioctl+0x298/0x30c [videodev])
> [<bf04c728>] (__video_do_ioctl [videodev]) from [<bf04c110>] (video_usercopy+0x174/0x4e8 [videodev])
> [<bf04c110>] (video_usercopy [videodev]) from [<bf0475c8>] (v4l2_ioctl+0xc4/0xd8 [videodev])
> [<bf0475c8>] (v4l2_ioctl [videodev]) from [<c01efa78>] (do_vfs_ioctl+0x9c/0x8e4)
> [<c01efa78>] (do_vfs_ioctl) from [<c01f02f4>] (SyS_ioctl+0x34/0x5c)
> [<c01f02f4>] (SyS_ioctl) from [<c01078c0>] (ret_fast_syscall+0x0/0x3c)
>
> Fixes: 95dd7b7e30f3 ("[media] v4l2-ioctl.c: improve cropcap compatibility code")
> Signed-off-by: Javier Martinez Canillas <javier@osg.samsung.com>
>
> ---
>
> drivers/media/v4l2-core/v4l2-ioctl.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/media/v4l2-core/v4l2-ioctl.c b/drivers/media/v4l2-core/v4l2-ioctl.c
> index 28e5be2c2eef..528390f33b53 100644
> --- a/drivers/media/v4l2-core/v4l2-ioctl.c
> +++ b/drivers/media/v4l2-core/v4l2-ioctl.c
> @@ -2171,7 +2171,7 @@ static int v4l_cropcap(const struct v4l2_ioctl_ops *ops,
> * The determine_valid_ioctls() call already should ensure
> * that this can never happen, but just in case...
> */
> - if (WARN_ON(!ops->vidioc_cropcap && !ops->vidioc_cropcap))
> + if (WARN_ON(!ops->vidioc_cropcap && !ops->vidioc_g_selection))
> return -ENOTTY;
>
> if (ops->vidioc_cropcap)
>
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] [media] v4l2-ioctl.c: fix warning due wrong check in v4l_cropcap()
2016-06-15 6:09 ` Hans Verkuil
@ 2016-06-15 12:09 ` Javier Martinez Canillas
0 siblings, 0 replies; 3+ messages in thread
From: Javier Martinez Canillas @ 2016-06-15 12:09 UTC (permalink / raw)
To: Hans Verkuil, linux-kernel; +Cc: Mauro Carvalho Chehab, linux-media
Hello Hans,
On 06/15/2016 02:09 AM, Hans Verkuil wrote:
> On 06/14/2016 10:18 PM, Javier Martinez Canillas wrote:
>> Commit 95dd7b7e30f3 ("[media] v4l2-ioctl.c: improve cropcap compatibility
>> code") tried to check if both .vidioc_cropcap and .vidioc_g_selection are
>> NULL ops and warn if that was the case, but unfortunately the logic isn't
>> correct and instead checks for .vidioc_cropcap == NULL twice.
>>
>> So the v4l2 core will print the following warning if a driver has the ops
>> .vidioc_g_selection set but no .vidioc_cropcap callback:
>
> This fix is already queued up for 4.7.
>
Thanks, and sorry for missing that you already had a fix queued for this.
> Regards,
>
> Hans
>
>>
Best regards,
--
Javier Martinez Canillas
Open Source Group
Samsung Research America
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2016-06-15 12:09 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-06-14 20:18 [PATCH] [media] v4l2-ioctl.c: fix warning due wrong check in v4l_cropcap() Javier Martinez Canillas
2016-06-15 6:09 ` Hans Verkuil
2016-06-15 12:09 ` Javier Martinez Canillas
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).