>Number:         177155
>Category:       kern
>Synopsis:       [patch] Fixing clang warnings at /sys/dev/safe
>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 20:10: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:
===> safe (all)
/usr/src/sys/modules/safe/../../dev/safe/safe.c:1610:11: warning: comparison of 
unsigned expression >= 0 is always true [-Wtautological-compare]
        while (j >= 0) {
               ~ ^  ~
/usr/src/sys/modules/safe/../../dev/safe/safe.c:1622:11: warning: comparison of 
unsigned expression >= 0 is always true [-Wtautological-compare]
        while (j >= 0) {
               ~ ^  ~
2 warnings generated.

Proposed fix is replacing always true condition "j >= 0" with 1. I _hope_ this 
is the correct way to "fix" this.


>How-To-Repeat:
cd /sys/modules/safe and do "make" to see clang warnings.
>Fix:
Index: safe.c
===================================================================
--- safe.c      (revision 248555)
+++ safe.c      (working copy)
@@ -1607,7 +1607,7 @@
         * Advance src and dst to offset.
         */
        j = offset;
-       while (j >= 0) {
+       while (1) {
                if (srcm->m_len > j)
                        break;
                j -= srcm->m_len;
@@ -1619,7 +1619,7 @@
        slen = srcm->m_len - j;
 
        j = offset;
-       while (j >= 0) {
+       while (1) {
                if (dstm->m_len > j)
                        break;
                j -= dstm->m_len;


>Release-Note:
>Audit-Trail:
>Unformatted:
_______________________________________________
freebsd-bugs@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-bugs
To unsubscribe, send any mail to "freebsd-bugs-unsubscr...@freebsd.org"

Reply via email to