* [PATCH] lib/mpi/mpicoder.c: looping issue, need stop when equal to zero, found by 'EXTRA_FLAGS=-W'.
@ 2013-05-20 5:08 Chen Gang
2013-05-20 10:13 ` David Howells
0 siblings, 1 reply; 3+ messages in thread
From: Chen Gang @ 2013-05-20 5:08 UTC (permalink / raw)
To: james.l.morris, Rusty Russell, dmitry.kasatkin,
dhowells@redhat.com, andriy.shevchenko
Cc: Andrew Morton, linux-kernel@vger.kernel.org
For 'while' looping, need stop when 'nbytes == 0', or will cause issue.
('nbytes' is size_t which is always bigger or equal than zero).
The related warning: (with EXTRA_CFLAGS=-W)
lib/mpi/mpicoder.c:40:2: warning: comparison of unsigned expression >= 0 is always true [-Wtype-limits]
Signed-off-by: Chen Gang <gang.chen@asianux.com>
---
lib/mpi/mpicoder.c | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/lib/mpi/mpicoder.c b/lib/mpi/mpicoder.c
index 5f9c44c..4cc6442 100644
--- a/lib/mpi/mpicoder.c
+++ b/lib/mpi/mpicoder.c
@@ -37,7 +37,7 @@ MPI mpi_read_raw_data(const void *xbuffer, size_t nbytes)
mpi_limb_t a;
MPI val = NULL;
- while (nbytes >= 0 && buffer[0] == 0) {
+ while (nbytes > 0 && buffer[0] == 0) {
buffer++;
nbytes--;
}
--
1.7.7.6
^ permalink raw reply related [flat|nested] 3+ messages in thread* Re: [PATCH] lib/mpi/mpicoder.c: looping issue, need stop when equal to zero, found by 'EXTRA_FLAGS=-W'.
2013-05-20 5:08 [PATCH] lib/mpi/mpicoder.c: looping issue, need stop when equal to zero, found by 'EXTRA_FLAGS=-W' Chen Gang
@ 2013-05-20 10:13 ` David Howells
2013-05-20 10:26 ` Chen Gang
0 siblings, 1 reply; 3+ messages in thread
From: David Howells @ 2013-05-20 10:13 UTC (permalink / raw)
To: Chen Gang
Cc: dhowells, james.l.morris, Rusty Russell, dmitry.kasatkin,
andriy.shevchenko, Andrew Morton, linux-kernel@vger.kernel.org
Chen Gang <gang.chen@asianux.com> wrote:
> For 'while' looping, need stop when 'nbytes == 0', or will cause issue.
> ('nbytes' is size_t which is always bigger or equal than zero).
>
> The related warning: (with EXTRA_CFLAGS=-W)
> lib/mpi/mpicoder.c:40:2: warning: comparison of unsigned expression >= 0 is always true [-Wtype-limits]
Acked-by: David Howells <dhowells@redhat.com>
^ permalink raw reply [flat|nested] 3+ messages in thread* Re: [PATCH] lib/mpi/mpicoder.c: looping issue, need stop when equal to zero, found by 'EXTRA_FLAGS=-W'.
2013-05-20 10:13 ` David Howells
@ 2013-05-20 10:26 ` Chen Gang
0 siblings, 0 replies; 3+ messages in thread
From: Chen Gang @ 2013-05-20 10:26 UTC (permalink / raw)
To: David Howells
Cc: james.l.morris, Rusty Russell, dmitry.kasatkin, andriy.shevchenko,
Andrew Morton, linux-kernel@vger.kernel.org
On 05/20/2013 06:13 PM, David Howells wrote:
> Chen Gang <gang.chen@asianux.com> wrote:
>
>> > For 'while' looping, need stop when 'nbytes == 0', or will cause issue.
>> > ('nbytes' is size_t which is always bigger or equal than zero).
>> >
>> > The related warning: (with EXTRA_CFLAGS=-W)
>> > lib/mpi/mpicoder.c:40:2: warning: comparison of unsigned expression >= 0 is always true [-Wtype-limits]
> Acked-by: David Howells <dhowells@redhat.com>
>
>
Thank you very much.
Thanks.
--
Chen Gang
Asianux Corporation
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2013-05-20 10:26 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-05-20 5:08 [PATCH] lib/mpi/mpicoder.c: looping issue, need stop when equal to zero, found by 'EXTRA_FLAGS=-W' Chen Gang
2013-05-20 10:13 ` David Howells
2013-05-20 10:26 ` Chen Gang
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox