mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH] mm: fix comparisons against unsigned
@ 2007-05-30  7:42 Bill Nottingham
  0 siblings, 0 replies; only message in thread
From: Bill Nottingham @ 2007-05-30  7:42 UTC (permalink / raw)
  To: linux-kernel

Recent gcc versions emit warnings when unsigned variables are compared < 0 or >= 0.

Signed-off-by: Bill Nottingham <notting@redhat.com>

---

 filemap.c |   34 ++++++++++++++++------------------
 slub.c    |    2 --
 2 files changed, 16 insertions(+), 20 deletions(-)

Patch is noisy due to whitespace.

diff -ru linux-2.6.21-old/mm/filemap.c linux-2.6.21/mm/filemap.c
--- linux-2.6.21-old/mm/filemap.c	2007-05-30 02:53:04.000000000 -0400
+++ linux-2.6.21/mm/filemap.c	2007-05-30 01:43:30.000000000 -0400
@@ -2176,24 +2176,22 @@
 			continue;
 		}
 zero_length_segment:
-		if (likely(copied >= 0)) {
-			if (!status)
-				status = copied;
-
-			if (status >= 0) {
-				written += status;
-				count -= status;
-				pos += status;
-				buf += status;
-				if (unlikely(nr_segs > 1)) {
-					filemap_set_next_iovec(&cur_iov,
-							&iov_base, status);
-					if (count)
-						buf = cur_iov->iov_base +
-							iov_base;
-				} else {
-					iov_base += status;
-				}
+		if (!status)
+			status = copied;
+
+		if (status >= 0) {
+			written += status;
+			count -= status;
+			pos += status;
+			buf += status;
+			if (unlikely(nr_segs > 1)) {
+				filemap_set_next_iovec(&cur_iov,
+						&iov_base, status);
+				if (count)
+					buf = cur_iov->iov_base +
+						iov_base;
+			} else {
+				iov_base += status;
 			}
 		}
 		if (unlikely(copied != bytes))
diff -ru linux-2.6.21-old/mm/slub.c linux-2.6.21/mm/slub.c
--- linux-2.6.21-old/mm/slub.c	2007-05-30 02:53:06.000000000 -0400
+++ linux-2.6.21/mm/slub.c	2007-05-30 01:45:33.000000000 -0400
@@ -1966,8 +1966,6 @@
 	s->size = size;
 
 	s->order = calculate_order(size);
-	if (s->order < 0)
-		return 0;
 
 	/*
 	 * Determine the number of objects per slab

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2007-05-30  7:44 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2007-05-30  7:42 [PATCH] mm: fix comparisons against unsigned Bill Nottingham

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®