Date: Wed, 20 Mar 2013 22:41:29 GMT From: hiren panchasara <hiren.panchasara@gmail.com> To: freebsd-gnats-submit@FreeBSD.org Subject: kern/177165: [patch] Fixing clang warnings at /sys/geom Message-ID: <201303202241.r2KMfT1b024964@red.freebsd.org> Resent-Message-ID: <201303202250.r2KMo0gI007231@freefall.freebsd.org>
next in thread | raw e-mail | index | archive | help
>Number: 177165 >Category: kern >Synopsis: [patch] Fixing clang warnings at /sys/geom >Confidential: no >Severity: non-critical >Priority: low >Responsible: freebsd-bugs >State: open >Quarter: >Keywords: >Date-Required: >Class: sw-bug >Submitter-Id: current-users >Arrival-Date: Wed Mar 20 22:50:00 UTC 2013 >Closed-Date: >Last-Modified: >Originator: hiren panchasara >Release: current >Organization: >Environment: 10.0-CURRENT FreeBSD 10.0-CURRENT #1 r248555: Wed Mar 20 15:00:20 UTC 2013 >Description: ===> geom/geom_cache (all) /usr/src/sys/modules/geom/geom_cache/../../../geom/cache/g_cache.c:76:10: warning: comparison of unsigned expression < 0 is always false [-Wtautological-compare] if (val < 0 || val > 100) ~~~ ^ ~ 1 warning generated. ===> geom/geom_journal (all) /usr/src/sys/modules/geom/geom_journal/../../../geom/journal/g_journal.c:178:14: warning: comparison of unsigned expression < 0 is always false [-Wtautological-compare] if (cswitch < 0 || cswitch > 100) ~~~~~~~ ^ ~ 1 warning generated. ===> geom/geom_raid (all) /usr/src/sys/modules/geom/geom_raid/../../../geom/raid/tr_raid5.c:109:11: warning: comparison of unsigned expression >= 0 is always true [-Wtautological-compare] qual >= 0 && qual <= 1) { ~~~~ ^ ~ /usr/src/sys/modules/geom/geom_raid/../../../geom/raid/tr_raid5.c:117:11: warning: comparison of unsigned expression >= 0 is always true [-Wtautological-compare] qual >= 0 && qual <= 3) { ~~~~ ^ ~ 2 warnings generated. >How-To-Repeat: cd /sys/modules/geom and do "make" to see clang warnings. >Fix: Index: sys/geom/cache/g_cache.c =================================================================== --- sys/geom/cache/g_cache.c (revision 248555) +++ sys/geom/cache/g_cache.c (working copy) @@ -73,7 +73,7 @@ error = sysctl_handle_int(oidp, &val, 0, req); if (error || !req->newptr) return (error); - if (val < 0 || val > 100) + if (val > 100) return (EINVAL); if ((arg1 == &g_cache_used_lo && val > g_cache_used_hi) || (arg1 == &g_cache_used_hi && g_cache_used_lo > val)) Index: sys/geom/journal/g_journal.c =================================================================== --- sys/geom/journal/g_journal.c (revision 248555) +++ sys/geom/journal/g_journal.c (working copy) @@ -175,7 +175,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; Index: sys/geom/raid/tr_raid5.c =================================================================== --- sys/geom/raid/tr_raid5.c (revision 248555) +++ sys/geom/raid/tr_raid5.c (working copy) @@ -106,7 +106,7 @@ trs = (struct g_raid_tr_raid5_object *)tr; qual = tr->tro_volume->v_raid_level_qualifier; if (tr->tro_volume->v_raid_level == G_RAID_VOLUME_RL_RAID4 && - qual >= 0 && qual <= 1) { + qual <= 1) { /* RAID4 */ } else if ((tr->tro_volume->v_raid_level == G_RAID_VOLUME_RL_RAID5 || tr->tro_volume->v_raid_level == G_RAID_VOLUME_RL_RAID5E || @@ -114,7 +114,7 @@ tr->tro_volume->v_raid_level == G_RAID_VOLUME_RL_RAID5R || tr->tro_volume->v_raid_level == G_RAID_VOLUME_RL_RAID6 || tr->tro_volume->v_raid_level == G_RAID_VOLUME_RL_RAIDMDF) && - qual >= 0 && qual <= 3) { + qual <= 3) { /* RAID5/5E/5EE/5R/6/MDF */ } else return (G_RAID_TR_TASTE_FAIL); >Release-Note: >Audit-Trail: >Unformatted:
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201303202241.r2KMfT1b024964>