NetBSD-Bugs archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

kern/47863: capi_ll_control() uses int argument for pointer type - does not work on e.g. amd64



>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:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Wed May 29 08:50:00 +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:

>Unformatted:
        
        



Home | Main Index | Thread Index | Old Index