NetBSD Problem Report #47863

From Wolfgang.Stukenbrock@nagler-company.com  Wed May 29 08:48:15 2013
Return-Path: <Wolfgang.Stukenbrock@nagler-company.com>
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 4E16170D0A
	for <gnats-bugs@gnats.NetBSD.org>; Wed, 29 May 2013 08:48:15 +0000 (UTC)
Message-Id: <20130529084805.83CF2123B93@test-s0.nagler-company.com>
Date: Wed, 29 May 2013 10:48:05 +0200 (CEST)
From: Wolfgang.Stukenbrock@nagler-company.com
Reply-To: Wolfgang.Stukenbrock@nagler-company.com
To: gnats-bugs@gnats.NetBSD.org
Subject: capi_ll_control() uses int argument for pointer type -  does not work on e.g. amd64
X-Send-Pr-Version: 3.95

>Number:         47863
>Category:       kern
>Synopsis:       capi_ll_control() uses int argument for pointer type -  does not work on e.g. amd64
>Confidential:   no
>Severity:       serious
>Priority:       high
>Responsible:    kern-bug-people
>State:          closed
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Wed May 29 08:50:00 +0000 2013
>Closed-Date:    Thu Jun 13 10:33:18 +0000 2013
>Last-Modified:  Thu Jun 13 10:33:18 +0000 2013
>Originator:     Dr. Wolfgang Stukenbrock
>Release:        NetBSD 6.1
>Organization:
Dr. Nagler & Company GmbH
>Environment:


System: NetBSD test-s0 5.1.2 NetBSD 5.1.2 (NSW-WS) #3: Fri Dec 21 15:15:43 CET 2012 wgstuken@test-s0:/usr/src/sys/arch/amd64/compile/NSW-WS amd64
Architecture: x86_64
Machine: amd64
>Description:
	In sys/netisdn/i4b_capi_llif.c in function capi_ll_control() the paramter
	"arg" is of type int, but casted to char* when used.
	Not the size of int is not equal to the size of a pointer on most 64-Bit platforms,
	so the resulting binary will not work as expected.
>How-To-Repeat:
	not relevant. Found by useing a ISDN-card in an 64-Bit system.
>Fix:
	The problems exist in NetBSD 5.x too.
	The following patches will solve this problem:
--- iavc.c      2010/05/12 08:28:01     1.1
+++ iavc.c      2012/05/02 14:47:00
@@ -621,7 +621,7 @@
                cardtype, serial, nbch, vers, prot);
        aprint_verbose_dev(&sc->sc_dev, "%s\n", caps);

-        capi_ll_control(&sc->sc_capi, CAPI_CTRL_PROFILE, (int) profile);
+        capi_ll_control(&sc->sc_capi, CAPI_CTRL_PROFILE, (intptr_t) profile);

     } else {
        printf("%s: no profile data in info response?\n", device_xname(&sc->sc_dev));

--- i4b_capi.h  2012/05/02 14:47:44     1.1
+++ i4b_capi.h  2012/05/02 14:47:59
@@ -119,7 +119,7 @@
 #define I4BCAPI_APPLID 1

 extern int capi_ll_attach(capi_softc_t *, const char *, const char *);
-extern int capi_ll_control(capi_softc_t *, int op, int arg);
+extern int capi_ll_control(capi_softc_t *, int op, intptr_t arg);
 extern int capi_ll_detach(capi_softc_t *);

 #define CAPI_CTRL_READY     0 /* ctrl ready, value=TRUE/FALSE */


--- i4b_capi_llif.c     2012/05/02 15:13:49     1.1
+++ i4b_capi_llif.c     2012/05/02 15:14:02
@@ -57,7 +57,7 @@
 */

 int
-capi_ll_control(capi_softc_t *sc, int op, int arg)
+capi_ll_control(capi_softc_t *sc, int op, intptr_t arg)
 {
     switch (op) {
     case CAPI_CTRL_READY:

>Release-Note:

>Audit-Trail:

State-Changed-From-To: open->pending-pullups
State-Changed-By: martin@NetBSD.org
State-Changed-When: Wed, 29 May 2013 09:29:22 +0000
State-Changed-Why:
Fixed in head, waiting for [pullup-6 #896]


From: "Martin Husemann" <martin@netbsd.org>
To: gnats-bugs@gnats.NetBSD.org
Cc: 
Subject: PR/47863 CVS commit: src/sys
Date: Wed, 29 May 2013 09:26:02 +0000

 Module Name:	src
 Committed By:	martin
 Date:		Wed May 29 09:26:02 UTC 2013

 Modified Files:
 	src/sys/dev/ic: iavc.c
 	src/sys/netisdn: i4b_capi.h i4b_capi_llif.c

 Log Message:
 Fix signature of capi_ll_control.
 From Wolfgang Stukenbrock in PR kern/47863.


 To generate a diff of this commit:
 cvs rdiff -u -r1.9 -r1.10 src/sys/dev/ic/iavc.c
 cvs rdiff -u -r1.5 -r1.6 src/sys/netisdn/i4b_capi.h \
     src/sys/netisdn/i4b_capi_llif.c

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

From: "SAITOH Masanobu" <msaitoh@netbsd.org>
To: gnats-bugs@gnats.NetBSD.org
Cc: 
Subject: PR/47863 CVS commit: [netbsd-6] src/sys
Date: Thu, 13 Jun 2013 07:22:45 +0000

 Module Name:	src
 Committed By:	msaitoh
 Date:		Thu Jun 13 07:22:45 UTC 2013

 Modified Files:
 	src/sys/dev/ic [netbsd-6]: iavc.c
 	src/sys/netisdn [netbsd-6]: i4b_capi.h i4b_capi_llif.c

 Log Message:
 Pull up following revision(s) (requested by martin in ticket #896):
 	sys/dev/ic/iavc.c: revision 1.10
 	sys/netisdn/i4b_capi_llif.c: revision 1.6
 	sys/netisdn/i4b_capi.h: revision 1.6
 Fix signature of capi_ll_control.
 From Wolfgang Stukenbrock in PR kern/47863.


 To generate a diff of this commit:
 cvs rdiff -u -r1.8 -r1.8.20.1 src/sys/dev/ic/iavc.c
 cvs rdiff -u -r1.5 -r1.5.94.1 src/sys/netisdn/i4b_capi.h
 cvs rdiff -u -r1.5 -r1.5.18.1 src/sys/netisdn/i4b_capi_llif.c

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

State-Changed-From-To: pending-pullups->closed
State-Changed-By: martin@NetBSD.org
State-Changed-When: Thu, 13 Jun 2013 10:33:18 +0000
State-Changed-Why:
pullups done


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