From: Dan Carpenter <dan.carpenter@oracle.com>
To: Colin King <colin.king@canonical.com>
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
"Rafael J . Wysocki" <rafael@kernel.org>,
Simon Schwartz <kern.simon@theschwartz.xyz>,
kernel-janitors@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH][next] driver core: platform: fix u32 greater or equal to zero comparison
Date: Fri, 17 Jan 2020 04:46:30 +0000 [thread overview]
Message-ID: <20200117044629.GC19765@kadam> (raw)
In-Reply-To: <20200117044216.GC21151@kadam>
On Fri, Jan 17, 2020 at 07:42:16AM +0300, Dan Carpenter wrote:
> On Thu, Jan 16, 2020 at 05:57:58PM +0000, Colin King wrote:
> > From: Colin Ian King <colin.king@canonical.com>
> >
> > Currently the check that a u32 variable i is >= 0 is always true because
> > the unsigned variable will never be negative, causing the loop to run
> > forever. Fix this by changing the pre-decrement check to a zero check on
> > i followed by a decrement of i.
> >
> > Addresses-Coverity: ("Unsigned compared against 0")
> > Fixes: 39cc539f90d0 ("driver core: platform: Prevent resouce overflow from causing infinite loops")
>
> A better fix would be to revert this patch. It doesn't fix a real bug.
> The ->num_resources is typically under 5. It's not going to overflow
> INT_MAX any time soon. There are "architectures with smaller ints."
I left out a word. There are *no* "architectures with smaller ints."...
I mean there used to be systems with 16 bit int but that was before I
was born. You could never run linux on them.
regards,
dan carpenter
WARNING: multiple messages have this Message-ID (diff)
From: Dan Carpenter <dan.carpenter@oracle.com>
To: Colin King <colin.king@canonical.com>
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
"Rafael J . Wysocki" <rafael@kernel.org>,
Simon Schwartz <kern.simon@theschwartz.xyz>,
kernel-janitors@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH][next] driver core: platform: fix u32 greater or equal to zero comparison
Date: Fri, 17 Jan 2020 07:46:30 +0300 [thread overview]
Message-ID: <20200117044629.GC19765@kadam> (raw)
In-Reply-To: <20200117044216.GC21151@kadam>
On Fri, Jan 17, 2020 at 07:42:16AM +0300, Dan Carpenter wrote:
> On Thu, Jan 16, 2020 at 05:57:58PM +0000, Colin King wrote:
> > From: Colin Ian King <colin.king@canonical.com>
> >
> > Currently the check that a u32 variable i is >= 0 is always true because
> > the unsigned variable will never be negative, causing the loop to run
> > forever. Fix this by changing the pre-decrement check to a zero check on
> > i followed by a decrement of i.
> >
> > Addresses-Coverity: ("Unsigned compared against 0")
> > Fixes: 39cc539f90d0 ("driver core: platform: Prevent resouce overflow from causing infinite loops")
>
> A better fix would be to revert this patch. It doesn't fix a real bug.
> The ->num_resources is typically under 5. It's not going to overflow
> INT_MAX any time soon. There are "architectures with smaller ints."
I left out a word. There are *no* "architectures with smaller ints."...
I mean there used to be systems with 16 bit int but that was before I
was born. You could never run linux on them.
regards,
dan carpenter
next prev parent reply other threads:[~2020-01-17 4:46 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-01-16 17:57 [PATCH][next] driver core: platform: fix u32 greater or equal to zero comparison Colin King
2020-01-16 20:37 ` Rafael J. Wysocki
2020-01-16 20:37 ` Rafael J. Wysocki
2020-01-17 4:42 ` Dan Carpenter
2020-01-17 4:42 ` Dan Carpenter
2020-01-17 4:46 ` Dan Carpenter [this message]
2020-01-17 4:46 ` Dan Carpenter
2020-01-17 5:06 ` Dan Carpenter
2020-01-17 5:06 ` Dan Carpenter
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=20200117044629.GC19765@kadam \
--to=dan.carpenter@oracle.com \
--cc=colin.king@canonical.com \
--cc=gregkh@linuxfoundation.org \
--cc=kern.simon@theschwartz.xyz \
--cc=kernel-janitors@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=rafael@kernel.org \
/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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.