From: Alan Stern <stern@rowland.harvard.edu>
To: Tang Bin <tangbin@cmss.chinamobile.com>
Cc: Colin King <colin.king@canonical.com>,
Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
Zhang Shengju <zhangshengju@cmss.chinamobile.com>,
linux-usb@vger.kernel.org, kernel-janitors@vger.kernel.org,
linux-kernel@vger.kernel.org
Subject: Re: [PATCH][next] USB: EHCI: ehci-mv: fix less than zero comparisonof an unsigned int
Date: Fri, 15 May 2020 21:17:11 -0400 [thread overview]
Message-ID: <20200516011711.GA13833@rowland.harvard.edu> (raw)
In-Reply-To: <fec1e461-16f3-9d5f-bc23-129c71229b9d@cmss.chinamobile.com>
On Sat, May 16, 2020 at 07:23:42AM +0800, Tang Bin wrote:
> Hi Alan & Colin:
>
> On 2020/5/16 1:21, Alan Stern wrote:
> > On Fri, May 15, 2020 at 05:54:53PM +0100, Colin King wrote:
> > > From: Colin Ian King <colin.king@canonical.com>
> > >
> > > The comparison of hcd->irq to less than zero for an error check will
> > > never be true because hcd->irq is an unsigned int. Fix this by
> > > assigning the int retval to the return of platform_get_irq and checking
> > > this for the -ve error condition and assigning hcd->irq to retval.
> > >
> > > Addresses-Coverity: ("Unsigned compared against 0")
> > > Fixes: c856b4b0fdb5 ("USB: EHCI: ehci-mv: fix error handling in mv_ehci_probe()")
> > > Signed-off-by: Colin Ian King <colin.king@canonical.com>
> > > ---
> > Thanks to Coverity for spotting this. Any reason why it didn't spot
> > exactly the same mistake in the ohci-da8xx.c driver?
>
> I just looked at the code and wondered whether it would be more appropriate
> to modify the header file "hcd.h". Since 'irq' might be an negative, why
> not just modify the variables in the 'struct usb_hcd', 'unsigned int
> irq'--> 'int irq'? After all, it's a public one.
I think the code in the drivers should be changed. The reason is if
platform_get_irq() returns a negative value, then that value should be
what the probe function returns.
Alan Stern
next prev parent reply other threads:[~2020-05-16 1:17 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-05-15 16:54 [PATCH][next] USB: EHCI: ehci-mv: fix less than zero comparison of an unsigned int Colin King
2020-05-15 17:21 ` Alan Stern
2020-05-15 17:26 ` Colin Ian King
2020-05-15 18:43 ` Alan Stern
2020-05-15 23:23 ` [PATCH][next] USB: EHCI: ehci-mv: fix less than zero comparisonof " Tang Bin
2020-05-16 1:17 ` Alan Stern [this message]
2020-05-16 6:30 ` [PATCH][next] USB: EHCI: ehci-mv: fix less than zero comparison of " Greg Kroah-Hartman
2020-05-16 9:25 ` Colin Ian King
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=20200516011711.GA13833@rowland.harvard.edu \
--to=stern@rowland.harvard.edu \
--cc=colin.king@canonical.com \
--cc=gregkh@linuxfoundation.org \
--cc=kernel-janitors@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-usb@vger.kernel.org \
--cc=tangbin@cmss.chinamobile.com \
--cc=zhangshengju@cmss.chinamobile.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;
as well as URLs for NNTP newsgroup(s).