Skip to content

Commit

Permalink
lib/mpi/mpicoder.c: looping issue, need stop when equal to zero, foun…
Browse files Browse the repository at this point in the history
…d by 'EXTRA_FLAGS=-W'.

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 <[email protected]>
Cc: Rusty Russell <[email protected]>
Cc: David Howells <[email protected]>
Cc: James Morris <[email protected]>
Cc: Andy Shevchenko <[email protected]>
Acked-by: David Howells <[email protected]>
Signed-off-by: Andrew Morton <[email protected]>
Signed-off-by: Linus Torvalds <[email protected]>
  • Loading branch information
Chen Gang authored and torvalds committed Jun 12, 2013
1 parent 637241a commit 5402b80
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion lib/mpi/mpicoder.c
Original file line number Diff line number Diff line change
Expand Up @@ -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--;
}
Expand Down

0 comments on commit 5402b80

Please sign in to comment.