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: <1589443500-3990-1-git-send-email-macpaul.lin@mediatek.com>
Date:   Thu, 14 May 2020 16:05:00 +0800
From:   Macpaul Lin <macpaul.lin@...iatek.com>
To:     Felipe Balbi <balbi@...nel.org>,
        Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
        Matthias Brugger <matthias.bgg@...il.com>,
        Michał Mirosław <mirq-linux@...e.qmqm.pl>,
        Sergey Organov <sorganov@...il.com>,
        Macpaul Lin <macpaul.lin@...iatek.com>,
        <linux-usb@...r.kernel.org>, <linux-kernel@...r.kernel.org>,
        <linux-arm-kernel@...ts.infradead.org>,
        <linux-mediatek@...ts.infradead.org>
CC:     Mediatek WSD Upstream <wsd_upstream@...iatek.com>,
        Macpaul Lin <macpaul.lin@...il.com>,
        Stan Lu <stan.lu@...iatek.com>
Subject: [PATCH] usb: gadget: u_serial: fix coverity warning: negative index at array

This issue has been reported by coverity scanner.
Replace "int portnum" by "unsigned int", this void negative index at
array.

Signed-off-by: Stan Lu <stan.lu@...iatek.com>
Signed-off-by: Macpaul Lin <macpaul.lin@...iatek.com>
---
 drivers/usb/gadget/function/u_serial.c |    4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/usb/gadget/function/u_serial.c b/drivers/usb/gadget/function/u_serial.c
index 8167d37..53951f2 100644
--- a/drivers/usb/gadget/function/u_serial.c
+++ b/drivers/usb/gadget/function/u_serial.c
@@ -587,7 +587,7 @@ static int gs_start_io(struct gs_port *port)
  */
 static int gs_open(struct tty_struct *tty, struct file *file)
 {
-	int		port_num = tty->index;
+	unsigned int	port_num = tty->index;
 	struct gs_port	*port;
 	int		status = 0;
 
@@ -1211,7 +1211,7 @@ int gserial_alloc_line_no_console(unsigned char *line_num)
 	struct gs_port			*port;
 	struct device			*tty_dev;
 	int				ret;
-	int				port_num;
+	unsigned int			port_num;
 
 	coding.dwDTERate = cpu_to_le32(9600);
 	coding.bCharFormat = 8;
-- 
1.7.9.5

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ