NetBSD Problem Report #33966

From dholland@eecs.harvard.edu  Mon Jul 10 16:14:55 2006
Return-Path: <dholland@eecs.harvard.edu>
Received: from mail.netbsd.org (mail.netbsd.org [204.152.190.11])
	by narn.NetBSD.org (Postfix) with ESMTP id BF2AF63B8C1
	for <gnats-bugs@gnats.NetBSD.org>; Mon, 10 Jul 2006 16:14:54 +0000 (UTC)
Message-Id: <20060710161407.B16A0FABA@tanaqui.eecs.harvard.edu>
Date: Mon, 10 Jul 2006 12:14:07 -0400 (EDT)
From: dholland@eecs.harvard.edu
Reply-To: dholland@eecs.harvard.edu
To: gnats-bugs@NetBSD.org
Subject: gcc4 build failure in scsipi/cd.c
X-Send-Pr-Version: 3.95

>Number:         33966
>Category:       kern
>Synopsis:       gcc4 build failure in scsipi/cd.c
>Confidential:   no
>Severity:       non-critical
>Priority:       medium
>Responsible:    kern-bug-people
>State:          closed
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Mon Jul 10 16:15:00 +0000 2006
>Closed-Date:    Sat Oct 07 14:36:36 +0000 2006
>Last-Modified:  Tue Oct 10 23:40:01 +0000 2006
>Originator:     David A. Holland <dholland@eecs.harvard.edu>
>Release:        NetBSD 3.99.21
>Organization:
   Harvard EECS
>Environment:


System: NetBSD weatherwax 3.99.21 NetBSD 3.99.21 (WEATHERWAX) #0: Fri Jul  7 13:37:33 EDT 2006  dholland@weatherwax:/usr/src/sys/arch/i386/compile/WEATHERWAX i386
Architecture: i386
Machine: i386
>Description:
        gcc4 issues some signedness warnings when compiling scsipi/cd.c.
        As the kernel builds with -Werror, this fails it, and as gcc4 is
        now the default, it fails by default.

>How-To-Repeat:
	Build a kernel with SCSI CD support using gcc4.
>Fix:

(This has been checked for any unwanted consequences of the signedness
change. Note that the actual warning occurs at a call to
read_cd_capacity, not any of the lines changed.)

Index: sys/dev/scsipi/cd.c
===================================================================
RCS file: /cvsroot/src/sys/dev/scsipi/cd.c,v
retrieving revision 1.242
diff -u -r1.242 cd.c
--- sys/dev/scsipi/cd.c	30 Mar 2006 16:09:28 -0000	1.242
+++ sys/dev/scsipi/cd.c	10 Jul 2006 16:12:15 -0000
@@ -1645,7 +1645,7 @@
  * we count.
  */
 static int
-read_cd_capacity(struct scsipi_periph *periph, int *blksize, u_long *size)
+read_cd_capacity(struct scsipi_periph *periph, uint32_t *blksize, u_long *size)
 {
 	struct scsipi_read_cd_capacity    cap_cmd;
 	struct scsipi_read_cd_cap_data    cap;
@@ -1728,7 +1728,7 @@
 static u_long
 cd_size(struct cd_softc *cd, int flags)
 {
-	int blksize;
+	uint32_t blksize;
 	u_long size;
 	int error;

@@ -1750,7 +1750,7 @@
 	cd->params.disksize512 = ((u_int64_t)cd->params.disksize * blksize) / DEV_BSIZE;

 	SC_DEBUG(cd->sc_periph, SCSIPI_DB2,
-	    ("cd_size: %d %ld\n", blksize, size));
+	    ("cd_size: %lu %ld\n", (unsigned long) blksize, size));

 	return size;
 }

>Release-Note:

>Audit-Trail:

State-Changed-From-To: open->feedback
State-Changed-By: bouyer@netbsd.org
State-Changed-When: Sun, 23 Jul 2006 11:17:13 +0000
State-Changed-Why:
I just ran a current build.sh release for i386 (so including GENERIC kernel
which has this driver) and it completed. Is it still a problem for you ?


From: dholland@eecs.harvard.edu (David Holland)
To: gnats-bugs@NetBSD.org
Cc: kern-bug-people@netbsd.org, netbsd-bugs@netbsd.org,
	gnats-admin@netbsd.org, bouyer@netbsd.org, dholland@eecs.harvard.edu
Subject: Re: kern/33966 (gcc4 build failure in scsipi/cd.c)
Date: Mon, 24 Jul 2006 18:52:05 -0400 (EDT)

  > Synopsis: gcc4 build failure in scsipi/cd.c
  > 
  > State-Changed-From-To: open->feedback
  > State-Changed-By: bouyer@netbsd.org
  > State-Changed-When: Sun, 23 Jul 2006 11:17:13 +0000
  > State-Changed-Why:
  > I just ran a current build.sh release for i386 (so including GENERIC kernel
  > which has this driver) and it completed. Is it still a problem for you ?

 It was operator error (i.e., my fault) that caused it to come up, but
 the patch is still a valid fix for building with -Wpointer-sign. See
 http://mail-index.netbsd.org/current-users/2006/07/10/0013.html.

 (I tried to send a copy of that to gnats, but evidently failed.)

 -- 
    - David A. Holland / dholland@eecs.harvard.edu

State-Changed-From-To: feedback->closed
State-Changed-By: elad@netbsd.org
State-Changed-When: Fri, 06 Oct 2006 22:31:12 +0000
State-Changed-Why:
user error #2..


State-Changed-From-To: closed->open
State-Changed-By: tron@netbsd.org
State-Changed-When: Sat, 07 Oct 2006 13:52:20 +0000
State-Changed-Why:
The patch still fixes an error.


State-Changed-From-To: open->closed
State-Changed-By: tron@netbsd.org
State-Changed-When: Sat, 07 Oct 2006 14:36:36 +0000
State-Changed-Why:
The bug was already fixed by this commit:

http://mail-index.netbsd.org/source-changes/2006/09/01/0010.html


From: dholland@eecs.harvard.edu
To: gnats-bugs@NetBSD.org
Cc: 
Subject: minor follow-on to kern/33966
Date: Tue, 10 Oct 2006 19:03:41 -0400 (EDT)

 >Submitter-Id:	net
 >Originator:	David A. Holland
 >Organization:
    Harvard EECS
 >Confidential:	no
 >Synopsis:	sign mismatch of printf formats in scsipi/cd.c
 >Severity:	non-critical
 >Priority:	medium
 >Category:	kern
 >Class:		sw-bug
 >Release:	NetBSD 3.99.21 (20061007; -r1.250 of cd.c)
 >Environment:
 System: NetBSD weatherwax 3.99.21 NetBSD 3.99.21 (WEATHERWAX) #1: Mon Jul 10 12:28:08 EDT 2006 dholland@weatherwax:/usr/src/sys/arch/i386/compile/WEATHERWAX i386
 Architecture: i386
 Machine: i386
 >Description:

 kern/33966 (about a -Wsign-compare issue in sys/dev/scsipi/cd.c) was
 obsoleted by rev 1.248 of cd.c. After fixing the merge conflicts in
 the tree containing the patch I'd sent, I discovered the committed
 change hadn't updated one of the printf formats.

 not a big deal, but worth fixing.

 >How-To-Repeat:
 -
 >Fix:

 patch:

 Index: sys/dev/scsipi/cd.c
 ===================================================================
 RCS file: /cvsroot/src/sys/dev/scsipi/cd.c,v
 retrieving revision 1.250
 diff -u -r1.250 cd.c
 --- sys/dev/scsipi/cd.c	8 Sep 2006 00:33:18 -0000	1.250
 +++ sys/dev/scsipi/cd.c	10 Oct 2006 22:59:05 -0000
 @@ -1750,7 +1750,7 @@
  	cd->params.disksize512 = ((u_int64_t)cd->params.disksize * blksize) / DEV_BSIZE;

  	SC_DEBUG(cd->sc_periph, SCSIPI_DB2,
 -	    ("cd_size: %d %ld\n", blksize, size));
 +	    ("cd_size: %u %lu\n", blksize, size));

  	return size;
  }

From: Jeff Rizzo <riz@netbsd.org>
To: gnats-bugs@NetBSD.org
Cc: 
Subject: PR/33966 CVS commit: src/sys/dev/scsipi
Date: Tue, 10 Oct 2006 23:30:23 +0000 (UTC)

 Module Name:	src
 Committed By:	riz
 Date:		Tue Oct 10 23:30:23 UTC 2006

 Modified Files:
 	src/sys/dev/scsipi: cd.c

 Log Message:
 Print an unsigned parameter with %lu, not %ld.  From David A. Holland
 in PR#33966.


 To generate a diff of this commit:
 cvs rdiff -r1.251 -r1.252 src/sys/dev/scsipi/cd.c

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

From: Jeff Rizzo <riz@netbsd.org>
To: gnats-bugs@NetBSD.org
Cc: 
Subject: PR/33966 CVS commit: src/sys/dev/scsipi
Date: Tue, 10 Oct 2006 23:35:30 +0000 (UTC)

 Module Name:	src
 Committed By:	riz
 Date:		Tue Oct 10 23:35:30 UTC 2006

 Modified Files:
 	src/sys/dev/scsipi: cd.c

 Log Message:
 Also print blksize with %u - this is what I get for eyeballing
 a patch instead of applying it directly.  PR#33966.


 To generate a diff of this commit:
 cvs rdiff -r1.252 -r1.253 src/sys/dev/scsipi/cd.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.51 2026/08/10 02:28:17 riastradh Exp $
$NetBSD: gnats_config.sh,v 1.10 2026/05/13 22:00:09 riastradh Exp $
Copyright © 1994-2026 The NetBSD Foundation, Inc. ALL RIGHTS RESERVED.