kernel-janitors.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] media: rc: fix check on dev->min_timeout for LIRC_GET_MIN_TIMEOUT ioctl
@ 2020-09-15 15:36 Colin King
  2020-09-15 17:12 ` Sean Young
  0 siblings, 1 reply; 3+ messages in thread
From: Colin King @ 2020-09-15 15:36 UTC (permalink / raw)
  To: Sean Young, Mauro Carvalho Chehab, Maxim Levitsky, linux-media
  Cc: kernel-janitors, linux-kernel

From: Colin Ian King <colin.king@canonical.com>

Currently the LIRC_GET_MIN_TIMEOUT is checking for a null dev->max_timeout
and then accessing dev->min_timeout, hence we may have a potential null
pointer dereference issue.  This looks like a cut-n-paste typo, fix it
by checking on dev->min_timeout before accessing it.

Addresses-Coverity: ("Copy-paste error")
Fixes: e589333f346b ("V4L/DVB: IR: extend interfaces to support more device settings")
Signed-off-by: Colin Ian King <colin.king@canonical.com>
---
 drivers/media/rc/lirc_dev.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/media/rc/lirc_dev.c b/drivers/media/rc/lirc_dev.c
index 220363b9a868..d230c21e1d31 100644
--- a/drivers/media/rc/lirc_dev.c
+++ b/drivers/media/rc/lirc_dev.c
@@ -533,7 +533,7 @@ static long lirc_ioctl(struct file *file, unsigned int cmd, unsigned long arg)
 
 	/* Generic timeout support */
 	case LIRC_GET_MIN_TIMEOUT:
-		if (!dev->max_timeout)
+		if (!dev->min_timeout)
 			ret = -ENOTTY;
 		else
 			val = dev->min_timeout;
-- 
2.27.0

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

end of thread, other threads:[~2020-09-15 17:14 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-09-15 15:36 [PATCH] media: rc: fix check on dev->min_timeout for LIRC_GET_MIN_TIMEOUT ioctl Colin King
2020-09-15 17:12 ` Sean Young
2020-09-15 17:14   ` Colin Ian King

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).