diff options
author | Hans Verkuil <hverkuil-cisco@xs4all.nl> | 2023-10-26 13:54:01 +0200 |
---|---|---|
committer | Mauro Carvalho Chehab <mchehab@kernel.org> | 2023-11-23 13:01:32 +0100 |
commit | 6aa210d27b5feaf81634973f28b896e208166f4c (patch) | |
tree | 08f33599089190a91514c81dac0cc24d321f80bf /drivers/media/v4l2-core | |
parent | 632b8b044a940e415c6d9bd5235778b0db28add1 (diff) | |
download | linux-6aa210d27b5feaf81634973f28b896e208166f4c.tar.gz linux-6aa210d27b5feaf81634973f28b896e208166f4c.tar.bz2 linux-6aa210d27b5feaf81634973f28b896e208166f4c.zip |
media: core: v4l2-ioctl: check if ioctl is known to avoid NULL name
When ioctl debugging is turned on, the v4l_printk_ioctl() is used
to log the ioctl that is called. It uses an array of ioctl information
to log the ioctl name and it correctly checks for out-of-bound indexing
of that array. However, the array may have holes since not all ioctl
numbers are used. In that case the name of the ioctl is NULL.
It is harmless (printk handles NULL pointers), but not intended. Instead
use the v4l2_is_known_ioctl() function to determine if the ioctl
information is available or not.
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
Diffstat (limited to 'drivers/media/v4l2-core')
-rw-r--r-- | drivers/media/v4l2-core/v4l2-ioctl.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/drivers/media/v4l2-core/v4l2-ioctl.c b/drivers/media/v4l2-core/v4l2-ioctl.c index 4d90424cbfc4..33076af4dfdb 100644 --- a/drivers/media/v4l2-core/v4l2-ioctl.c +++ b/drivers/media/v4l2-core/v4l2-ioctl.c @@ -2951,7 +2951,7 @@ void v4l_printk_ioctl(const char *prefix, unsigned int cmd) type = "v4l2_int"; break; case 'V': - if (_IOC_NR(cmd) >= V4L2_IOCTLS) { + if (!v4l2_is_known_ioctl(cmd)) { type = "v4l2"; break; } |