NetBSD-Bugs archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

kern/48547: Fix wrong conditional statement



>Number:         48547
>Category:       kern
>Synopsis:       Fix wrong conditional statement
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    kern-bug-people
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Fri Jan 24 02:20:00 +0000 2014
>Originator:     Ryota Ozaki
>Release:        current
>Organization:
IIJ
>Environment:
i386/amd64 (because it's a bug in DTrace)
>Description:
This patch fixes a obvious bug in external/cddl/osnet/dev/dtrace/dtrace_debug.c.

In dtrace_debug_output(), there is an if construct like this:

  if (d->first < d->next) {
  } else if (d->next > d->first) {
  }

The two conditional statements are equivalent so the else-if block will never 
be executed.
>How-To-Repeat:
We cannot see effects of the bug because there is no user of the dtrace debug 
facility for now.
>Fix:
Index: external/cddl/osnet/dev/dtrace/dtrace_debug.c
===================================================================
RCS file: /cvs/cvsroot/src/external/cddl/osnet/dev/dtrace/dtrace_debug.c,v
retrieving revision 1.6
diff -u -r1.6 dtrace_debug.c
--- external/cddl/osnet/dev/dtrace/dtrace_debug.c       14 Apr 2013 16:39:59 
-0000      1.6
+++ external/cddl/osnet/dev/dtrace/dtrace_debug.c       24 Jan 2014 02:00:21 
-0000
@@ -167,7 +167,7 @@
 
                        for (p = d->first; p < d->next; p++)
                                *p1++ = *p;
-               } else if (d->next > d->first) {
+               } else if (d->first > d->next) {
                        char *p1 = dtrace_debug_bufr;
 
                        count = (uintptr_t) d->last - (uintptr_t) d->first;



Home | Main Index | Thread Index | Old Index