NetBSD Problem Report #48547

From www@NetBSD.org  Fri Jan 24 02:17:02 2014
Return-Path: <www@NetBSD.org>
Received: from mail.netbsd.org (mail.netbsd.org [149.20.53.66])
	(using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits))
	(Client CN "mail.NetBSD.org", Issuer "Postmaster NetBSD.org" (not verified))
	by mollari.NetBSD.org (Postfix) with ESMTPS id 423E8A6482
	for <gnats-bugs@gnats.NetBSD.org>; Fri, 24 Jan 2014 02:17:02 +0000 (UTC)
Message-Id: <20140124021700.E7998A648B@mollari.NetBSD.org>
Date: Fri, 24 Jan 2014 02:17:00 +0000 (UTC)
From: ozaki-r@iij.ad.jp
Reply-To: ozaki-r@iij.ad.jp
To: gnats-bugs@NetBSD.org
Subject: Fix wrong conditional statement
X-Send-Pr-Version: www-1.0

>Number:         48547
>Category:       kern
>Synopsis:       Fix wrong conditional statement
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    kern-bug-people
>State:          closed
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Fri Jan 24 02:20:00 +0000 2014
>Closed-Date:    Tue Mar 04 03:46:26 +0000 2014
>Last-Modified:  Tue Mar 04 14:15: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;

>Release-Note:

>Audit-Trail:

State-Changed-From-To: open->closed
State-Changed-By: ozaki-r@NetBSD.org
State-Changed-When: Tue, 04 Mar 2014 03:46:26 +0000
State-Changed-Why:
The patch is committed.


From: "Ryota Ozaki" <ozaki-r@netbsd.org>
To: gnats-bugs@gnats.NetBSD.org
Cc: 
Subject: PR/48547 CVS commit: src/external/cddl/osnet/dev/dtrace
Date: Tue, 4 Mar 2014 03:20:49 +0000

 Module Name:	src
 Committed By:	ozaki-r
 Date:		Tue Mar  4 03:20:49 UTC 2014

 Modified Files:
 	src/external/cddl/osnet/dev/dtrace: dtrace_debug.c

 Log Message:
 Fix wrong conditional statement in dtrace_debug_output

 Reported in PR kern/48547 by ozaki-r.


 To generate a diff of this commit:
 cvs rdiff -u -r1.6 -r1.7 src/external/cddl/osnet/dev/dtrace/dtrace_debug.c

 Please note that diffs are not public domain; they are subject to the
 copyright notices on the relevant files.

>Unformatted:

NetBSD Home
NetBSD PR Database Search

(Contact us) $NetBSD: query-full-pr,v 1.39 2013/11/01 18:47:49 spz Exp $
$NetBSD: gnats_config.sh,v 1.8 2006/05/07 09:23:38 tsutsui Exp $
Copyright © 1994-2007 The NetBSD Foundation, Inc. ALL RIGHTS RESERVED.