lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20190512201551.18724-3-jmkrzyszt@gmail.com>
Date:   Sun, 12 May 2019 22:15:49 +0200
From:   Janusz Krzysztofik <jmkrzyszt@...il.com>
To:     Mauro Carvalho Chehab <mchehab@...nel.org>
Cc:     Hans Verkuil <hverkuil-cisco@...all.nl>,
        Sakari Ailus <sakari.ailus@...ux.intel.com>,
        linux-media@...r.kernel.org, linux-kernel@...r.kernel.org,
        Janusz Krzysztofik <jmkrzyszt@...il.com>
Subject: [PATCH v5 2/4] media: v4l2-subdev: WARN_ON invalid v4l2_subdev_call() arguments

Invalid arguments passed to v4l2_subdev_call generally mean bugs.  Be
noisy if that happens.

Signed-off-by: Janusz Krzysztofik <jmkrzyszt@...il.com>
---
 drivers/media/v4l2-core/v4l2-subdev.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/drivers/media/v4l2-core/v4l2-subdev.c b/drivers/media/v4l2-core/v4l2-subdev.c
index 890916674d42..5f2264575cd7 100644
--- a/drivers/media/v4l2-core/v4l2-subdev.c
+++ b/drivers/media/v4l2-core/v4l2-subdev.c
@@ -122,8 +122,8 @@ static int subdev_close(struct file *file)
 
 static int check_which(__u32 which)
 {
-	if (which != V4L2_SUBDEV_FORMAT_TRY &&
-	    which != V4L2_SUBDEV_FORMAT_ACTIVE)
+	if (WARN_ON(which != V4L2_SUBDEV_FORMAT_TRY &&
+		    which != V4L2_SUBDEV_FORMAT_ACTIVE))
 		return -EINVAL;
 
 	return 0;
@@ -132,7 +132,7 @@ static int check_which(__u32 which)
 static int check_pad(struct v4l2_subdev *sd, __u32 pad)
 {
 #if defined(CONFIG_MEDIA_CONTROLLER)
-	if (sd->entity.num_pads && pad >= sd->entity.num_pads)
+	if (WARN_ON(sd->entity.num_pads && pad >= sd->entity.num_pads))
 		return -EINVAL;
 #endif
 	return 0;
@@ -228,7 +228,7 @@ static int check_set_selection(struct v4l2_subdev *sd,
 
 static int check_edid(struct v4l2_subdev *sd, struct v4l2_subdev_edid *edid)
 {
-	if (edid->blocks && edid->edid == NULL)
+	if (WARN_ON(edid->blocks && edid->edid == NULL))
 		return -EINVAL;
 
 	return check_pad(sd, edid->pad);
-- 
2.21.0

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ