NetBSD Problem Report #50951

From www@NetBSD.org  Fri Mar 11 17:23:12 2016
Return-Path: <www@NetBSD.org>
Received: from mail.netbsd.org (mail.netbsd.org [199.233.217.200])
	(using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits))
	(Client CN "mail.netbsd.org", Issuer "Postmaster NetBSD.org" (verified OK))
	by mollari.NetBSD.org (Postfix) with ESMTPS id 14E9F7A20E
	for <gnats-bugs@gnats.NetBSD.org>; Fri, 11 Mar 2016 17:23:12 +0000 (UTC)
Message-Id: <20160311172311.38D407ACB9@mollari.NetBSD.org>
Date: Fri, 11 Mar 2016 17:23:11 +0000 (UTC)
From: dcb314@hotmail.com
Reply-To: dcb314@hotmail.com
To: gnats-bugs@NetBSD.org
Subject: src/sys/fs/cd9660/cd9660_vnops.c:322]: style) Suspicious condition
X-Send-Pr-Version: www-1.0

>Number:         50951
>Category:       kern
>Synopsis:       src/sys/fs/cd9660/cd9660_vnops.c:322]: style) Suspicious condition
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    kern-bug-people
>State:          closed
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Fri Mar 11 17:25:01 +0000 2016
>Closed-Date:    Sat Mar 12 03:31:25 +0000 2016
>Last-Modified:  Sat Mar 12 03:31:25 +0000 2016
>Originator:     David Binderman
>Release:        cvs dated 20160311
>Organization:
>Environment:
>Description:

src/sys/fs/cd9660/cd9660_vnops.c:322]: (style) Suspicious condition (assignment + comparison); Clarify expression with parentheses.


Source code is

    if ((assoc = cl > 1 && *cname == ASSOCCHAR)) {


Maybe better code

     if (((assoc = (cl > 1)) != 0 && *cname == ASSOCCHAR)) {













>How-To-Repeat:

>Fix:

>Release-Note:

>Audit-Trail:
From: "Christos Zoulas" <christos@netbsd.org>
To: gnats-bugs@gnats.NetBSD.org
Cc: 
Subject: PR/50951 CVS commit: src/sys/fs/cd9660
Date: Fri, 11 Mar 2016 13:35:50 -0500

 Module Name:	src
 Committed By:	christos
 Date:		Fri Mar 11 18:35:50 UTC 2016

 Modified Files:
 	src/sys/fs/cd9660: cd9660_vnops.c

 Log Message:
 PR/50951: David Binderman: Fix misplaced parens


 To generate a diff of this commit:
 cvs rdiff -u -r1.52 -r1.53 src/sys/fs/cd9660/cd9660_vnops.c

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

From: David Holland <dholland-bugs@netbsd.org>
To: gnats-bugs@NetBSD.org
Cc: 
Subject: Re: PR/50951 CVS commit: src/sys/fs/cd9660
Date: Sat, 12 Mar 2016 01:48:36 +0000

 On Fri, Mar 11, 2016 at 06:40:00PM +0000, Christos Zoulas wrote:
  >  Modified Files:
  >  	src/sys/fs/cd9660: cd9660_vnops.c
  >  
  >  Log Message:
  >  PR/50951: David Binderman: Fix misplaced parens
  > 
  > -       if ((assoc = cl > 1 && *cname == ASSOCCHAR)) {
  > +       if ((assoc = cl) > 1 && *cname == ASSOCCHAR) {


 ...speaking of potentially messing up, I think this one ought to be

         if ((assoc = (cl > 1)) && *cname == ASSOCCHAR) {

 based on the use of "assoc" further down in the function.

 -- 
 David A. Holland
 dholland@netbsd.org

From: "Christos Zoulas" <christos@netbsd.org>
To: gnats-bugs@gnats.NetBSD.org
Cc: 
Subject: PR/50951 CVS commit: src/sys/fs/cd9660
Date: Fri, 11 Mar 2016 21:36:25 -0500

 Module Name:	src
 Committed By:	christos
 Date:		Sat Mar 12 02:36:25 UTC 2016

 Modified Files:
 	src/sys/fs/cd9660: cd9660_vnops.c

 Log Message:
 PR/50951: Unmess this up.


 To generate a diff of this commit:
 cvs rdiff -u -r1.53 -r1.54 src/sys/fs/cd9660/cd9660_vnops.c

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

From: David Holland <dholland-bugs@netbsd.org>
To: gnats-bugs@netbsd.org
Cc: 
Subject: Re: PR/50951 CVS commit: src/sys/fs/cd9660
Date: Sat, 12 Mar 2016 03:17:06 +0000

 On Sat, Mar 12, 2016 at 01:50:01AM +0000, David Holland wrote:
  >> -       if ((assoc = cl > 1 && *cname == ASSOCCHAR)) {
  >> +       if ((assoc = cl) > 1 && *cname == ASSOCCHAR) {
  >  
  >  
  >  ...speaking of potentially messing up, I think this one ought to be
  >  
  >          if ((assoc = (cl > 1)) && *cname == ASSOCCHAR) {
  >  
  >  based on the use of "assoc" further down in the function.

 or not quite.

 christos has it now I think.

 -- 
 David A. Holland
 dholland@netbsd.org

State-Changed-From-To: open->closed
State-Changed-By: dholland@NetBSD.org
State-Changed-When: Sat, 12 Mar 2016 03:31:25 +0000
State-Changed-Why:
fixed, thanks


>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-2014 The NetBSD Foundation, Inc. ALL RIGHTS RESERVED.