mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Macpaul Lin <macpaul.lin@mediatek.com>
To: "Felipe Balbi" <balbi@kernel.org>,
	"Greg Kroah-Hartman" <gregkh@linuxfoundation.org>,
	"Matthias Brugger" <matthias.bgg@gmail.com>,
	"Michał Mirosław" <mirq-linux@rere.qmqm.pl>,
	"Sergey Organov" <sorganov@gmail.com>,
	"Macpaul Lin" <macpaul.lin@mediatek.com>,
	linux-usb@vger.kernel.org, linux-kernel@vger.kernel.org,
	linux-arm-kernel@lists.infradead.org,
	linux-mediatek@lists.infradead.org
Cc: Mediatek WSD Upstream <wsd_upstream@mediatek.com>,
	Macpaul Lin <macpaul.lin@gmail.com>,
	Stan Lu <stan.lu@mediatek.com>
Subject: [PATCH] usb: gadget: u_serial: fix coverity warning: negative index at array
Date: Thu, 14 May 2020 16:05:00 +0800	[thread overview]
Message-ID: <1589443500-3990-1-git-send-email-macpaul.lin@mediatek.com> (raw)

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@mediatek.com>
Signed-off-by: Macpaul Lin <macpaul.lin@mediatek.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

             reply	other threads:[~2020-05-14  8:05 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-05-14  8:05 Macpaul Lin [this message]
2020-05-14  9:38 ` Felipe Balbi
2020-05-14 14:22 ` Alan Stern

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1589443500-3990-1-git-send-email-macpaul.lin@mediatek.com \
    --to=macpaul.lin@mediatek.com \
    --cc=balbi@kernel.org \
    --cc=gregkh@linuxfoundation.org \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mediatek@lists.infradead.org \
    --cc=linux-usb@vger.kernel.org \
    --cc=macpaul.lin@gmail.com \
    --cc=matthias.bgg@gmail.com \
    --cc=mirq-linux@rere.qmqm.pl \
    --cc=sorganov@gmail.com \
    --cc=stan.lu@mediatek.com \
    --cc=wsd_upstream@mediatek.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®