NetBSD Problem Report #48338

From www@NetBSD.org  Thu Oct 24 18:51:14 2013
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" (verified OK))
	by mollari.NetBSD.org (Postfix) with ESMTPS id C4620A5A61
	for <gnats-bugs@gnats.NetBSD.org>; Thu, 24 Oct 2013 18:51:14 +0000 (UTC)
Message-Id: <20131024185113.A63AFA5AD9@mollari.NetBSD.org>
Date: Thu, 24 Oct 2013 18:51:13 +0000 (UTC)
From: dcb314@hotmail.com
Reply-To: dcb314@hotmail.com
To: gnats-bugs@NetBSD.org
Subject: netbsd-iscsi-20080207/src/util.c:1165: possible bad if test ?
X-Send-Pr-Version: www-1.0

>Number:         48338
>Category:       misc
>Synopsis:       netbsd-iscsi-20080207/src/util.c:1165: possible bad if test ?
>Confidential:   no
>Severity:       serious
>Priority:       low
>Responsible:    misc-bug-people
>State:          closed
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Thu Oct 24 18:55:01 +0000 2013
>Closed-Date:    Mon Dec 09 14:52:15 +0000 2013
>Last-Modified:  Mon Dec 09 14:52:15 +0000 2013
>Originator:     David Binderman
>Release:        8
>Organization:
>Environment:
Linux
>Description:
I just compiled package netbsd-iscsi on Linux with extra flag -Wlogical-op

It said

util.c:1165:2: warning: logical 'or' of collectively exhaustive tests is always true [-Wlogical-op]

Source code is

    if ((text[0] == '0') && (text[1] != 'x' || text[1] != 'X')) {

Suggest swap || for &&

>How-To-Repeat:

>Fix:

>Release-Note:

>Audit-Trail:
From: Martin Husemann <martin@duskware.de>
To: gnats-bugs@NetBSD.org
Cc: 
Subject: Re: misc/48338: netbsd-iscsi-20080207/src/util.c:1165: possible bad if test ?
Date: Thu, 24 Oct 2013 21:12:32 +0200

 --uAKRQypu60I7Lcqm
 Content-Type: text/plain; charset=us-ascii
 Content-Disposition: inline

 I've commited this patch.

 Martin


 --uAKRQypu60I7Lcqm
 Content-Type: text/plain; charset=us-ascii
 Content-Disposition: attachment; filename=patch

 Index: util.c
 ===================================================================
 RCS file: /cvsroot/src/external/bsd/iscsi/dist/src/lib/util.c,v
 retrieving revision 1.3
 diff -u -r1.3 util.c
 --- util.c	15 Mar 2012 04:06:55 -0000	1.3
 +++ util.c	24 Oct 2013 19:11:49 -0000
 @@ -1273,7 +1273,7 @@
  	uint32_t    n2;
  	uint32_t    len = 0;

 -	if ((text[0] == '0') && (text[1] != 'x' || text[1] != 'X')) {
 +	if ((text[0] == '0') && (text[1] == 'x' || text[1] == 'X')) {
  		/* skip prefix */
  		text += 2;
  		textLength -= 2;

 --uAKRQypu60I7Lcqm--

From: "Martin Husemann" <martin@netbsd.org>
To: gnats-bugs@gnats.NetBSD.org
Cc: 
Subject: PR/48338 CVS commit: src/external/bsd/iscsi/dist/src/lib
Date: Thu, 24 Oct 2013 19:13:26 +0000

 Module Name:	src
 Committed By:	martin
 Date:		Thu Oct 24 19:13:26 UTC 2013

 Modified Files:
 	src/external/bsd/iscsi/dist/src/lib: util.c

 Log Message:
 PR 48338: fix typo making a boolean expression always true


 To generate a diff of this commit:
 cvs rdiff -u -r1.3 -r1.4 src/external/bsd/iscsi/dist/src/lib/util.c

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

State-Changed-From-To: open->feedback
State-Changed-By: dholland@NetBSD.org
State-Changed-When: Fri, 25 Oct 2013 16:32:47 +0000
State-Changed-Why:
patch committed; ok to close?


State-Changed-From-To: feedback->closed
State-Changed-By: dholland@NetBSD.org
State-Changed-When: Mon, 09 Dec 2013 14:52:15 +0000
State-Changed-Why:
Submitter wrote the gnats admin mailbox to say it was ok to close.


>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.