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-next>] [day] [month] [year] [list]
Message-Id: <20180124214043.16429-1-chrisadr@gentoo.org>
Date:   Wed, 24 Jan 2018 16:40:43 -0500
From:   Christopher Díaz Riveros <chrisadr@...too.org>
To:     mchehab@...nel.org, hans.verkuil@...co.com,
        arvind.yadav.cs@...il.com, dean@...soray.com,
        keescook@...omium.org, bhumirks@...il.com,
        sakari.ailus@...ux.intel.com
Cc:     linux-media@...r.kernel.org, linux-kernel@...r.kernel.org,
        kernel-janitors@...r.kernel.org
Subject: [PATCH-next] media: s2255drv: Remove unneeded if else blocks

Given the following definitions from s2255drv.c

 #define LINE_SZ_4CIFS_NTSC      640
 #define LINE_SZ_2CIFS_NTSC      640
 #define LINE_SZ_1CIFS_NTSC      320

and

 #define LINE_SZ_4CIFS_PAL       704
 #define LINE_SZ_2CIFS_PAL       704
 #define LINE_SZ_1CIFS_PAL       352

f->fmt.pix.width possible values can be reduced to
LINE_SZ_4CIFS_NTSC or LINE_SZ_1CIFS_NTSC.

This patch removes unneeded if else blocks in vidioc_try_fmt_vid_cap
function.

This issue was detected by using the Coccinelle software.

Signed-off-by: Christopher Díaz Riveros <chrisadr@...too.org>
---
 drivers/media/usb/s2255/s2255drv.c | 8 --------
 1 file changed, 8 deletions(-)

diff --git a/drivers/media/usb/s2255/s2255drv.c b/drivers/media/usb/s2255/s2255drv.c
index 8c2a86d71e8a..a00a15f55d37 100644
--- a/drivers/media/usb/s2255/s2255drv.c
+++ b/drivers/media/usb/s2255/s2255drv.c
@@ -803,10 +803,6 @@ static int vidioc_try_fmt_vid_cap(struct file *file, void *priv,
 		}
 		if (f->fmt.pix.width >= LINE_SZ_4CIFS_NTSC)
 			f->fmt.pix.width = LINE_SZ_4CIFS_NTSC;
-		else if (f->fmt.pix.width >= LINE_SZ_2CIFS_NTSC)
-			f->fmt.pix.width = LINE_SZ_2CIFS_NTSC;
-		else if (f->fmt.pix.width >= LINE_SZ_1CIFS_NTSC)
-			f->fmt.pix.width = LINE_SZ_1CIFS_NTSC;
 		else
 			f->fmt.pix.width = LINE_SZ_1CIFS_NTSC;
 	} else {
@@ -820,10 +816,6 @@ static int vidioc_try_fmt_vid_cap(struct file *file, void *priv,
 		}
 		if (f->fmt.pix.width >= LINE_SZ_4CIFS_PAL)
 			f->fmt.pix.width = LINE_SZ_4CIFS_PAL;
-		else if (f->fmt.pix.width >= LINE_SZ_2CIFS_PAL)
-			f->fmt.pix.width = LINE_SZ_2CIFS_PAL;
-		else if (f->fmt.pix.width >= LINE_SZ_1CIFS_PAL)
-			f->fmt.pix.width = LINE_SZ_1CIFS_PAL;
 		else
 			f->fmt.pix.width = LINE_SZ_1CIFS_PAL;
 	}
-- 
2.16.0

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ