[PATCH] media: core: v4l2-ioctl: check if ioctl is known to avoid NULL name

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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@xxxxxxxxx>
---
diff --git a/drivers/media/v4l2-core/v4l2-ioctl.c b/drivers/media/v4l2-core/v4l2-ioctl.c
index 9b1de54ce379..d4104564703b 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;
 		}



[Index of Archives]     [Linux Input]     [Video for Linux]     [Gstreamer Embedded]     [Mplayer Users]     [Linux USB Devel]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [Yosemite Backpacking]

  Powered by Linux