Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 20 Mar 2013 19:35:05 GMT
From:      hiren panchasara <hiren.panchasara@gmail.com>
To:        freebsd-gnats-submit@FreeBSD.org
Subject:   kern/177153: [patch] Fixing clang warnings at /sys/ufs/ufs
Message-ID:  <201303201935.r2KJZ5DQ021705@red.freebsd.org>
Resent-Message-ID: <201303201940.r2KJe1NP071495@freefall.freebsd.org>

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

>Number:         177153
>Category:       kern
>Synopsis:       [patch] Fixing clang warnings at /sys/ufs/ufs
>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 19:40:01 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:
===> ufs (all)
/usr/src/sys/modules/ufs/../../ufs/ufs/ufs_quota.c:327:44: warning: comparison of unsigned expression >= 0 is always true [-Wtautological-compare]
                        if (dq->dq_curinodes != 0 && ncurinodes >= 0)
                                                     ~~~~~~~~~~ ^  ~
/usr/src/sys/modules/ufs/../../ufs/ufs/ufs_quota.c:365:21: warning: comparison of unsigned expression >= 0 is always true [-Wtautological-compare]
                                            ncurinodes >= 0)
                                            ~~~~~~~~~~ ^  ~
2 warnings generated.

>How-To-Repeat:
cd /sys/modules/ufs
make

and you will see warnings from clang.
>Fix:
Index: sys/ufs/ufs/ufs_quota.c
===================================================================
--- sys/ufs/ufs/ufs_quota.c     (revision 248555)
+++ sys/ufs/ufs/ufs_quota.c     (working copy)
@@ -324,7 +324,7 @@
                        DQI_WAIT(dq, PINOD+1, "chkiq1");
                        ncurinodes = dq->dq_curinodes + change;
                        /* XXX: ncurinodes is unsigned */
-                       if (dq->dq_curinodes != 0 && ncurinodes >= 0)
+                       if (dq->dq_curinodes != 0)
                                dq->dq_curinodes = ncurinodes;
                        else
                                dq->dq_curinodes = 0;
@@ -361,8 +361,7 @@
                                        DQI_WAIT(dq, PINOD+1, "chkiq3");
                                        ncurinodes = dq->dq_curinodes - change;
                                        /* XXX: ncurinodes is unsigned */
-                                       if (dq->dq_curinodes != 0 &&
-                                           ncurinodes >= 0)
+                                       if (dq->dq_curinodes != 0)
                                                dq->dq_curinodes = ncurinodes;
                                        else
                                                dq->dq_curinodes = 0;


>Release-Note:
>Audit-Trail:
>Unformatted:



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