Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 7 Feb 2011 21:37:38 +0000
From:      Alexander Best <arundel@freebsd.org>
To:        freebsd-geom@freebsd.org
Subject:   [patch] comparison of u_int against < 0 in g_journal.c
Message-ID:  <20110207213738.GA54609@freebsd.org>

next in thread | raw e-mail | index | archive | help

--45Z9DzgjV8m4Oswq
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline

hi there,

this was reported by clang 2.9 (dev) as -Wtautological-compare warning. i think
clang is right, because cswitch is of type u_int.

cheers.
alex

-- 
a13x

--45Z9DzgjV8m4Oswq
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment; filename="g_journal.c.diff"

Index: sys/geom/journal/g_journal.c
===================================================================
--- sys/geom/journal/g_journal.c	(revision 218413)
+++ sys/geom/journal/g_journal.c	(working copy)
@@ -173,7 +173,7 @@
 	error = sysctl_handle_int(oidp, &cswitch, 0, req);
 	if (error != 0 || req->newptr == NULL)
 		return (error);
-	if (cswitch < 0 || cswitch > 100)
+	if (cswitch > 100)
 		return (EINVAL);
 	g_journal_cache_switch = cswitch;
 	g_journal_cache_low = (g_journal_cache_limit / 100) * cswitch;

--45Z9DzgjV8m4Oswq--



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20110207213738.GA54609>