netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] isdn capi driver broken on 64 bit.
@ 2007-08-24 18:08 Stephen Hemminger
  2007-08-27 11:02 ` Karsten Keil
  0 siblings, 1 reply; 3+ messages in thread
From: Stephen Hemminger @ 2007-08-24 18:08 UTC (permalink / raw)
  To: Karsten Keil; +Cc: isdn4linux, netdev

The following driver API is broken on any architecture with 64 bit addresses.
because of cast that loses high bits.

Signed-off-by: Stephen Hemminger <shemminger@linux-foundation.org>


--- a/drivers/isdn/capi/capidrv.c	2007-06-25 09:03:12.000000000 -0700
+++ b/drivers/isdn/capi/capidrv.c	2007-08-24 11:06:46.000000000 -0700
@@ -1855,6 +1855,9 @@ static int if_sendbuf(int id, int channe
 		return 0;
 	}
 	datahandle = nccip->datahandle;
+
+	/* This won't work on 64 bit! */
+	BUILD_BUG_ON(sizeof(skb->data) > sizeof(u32));
 	capi_fill_DATA_B3_REQ(&sendcmsg, global.ap.applid, card->msgid++,
 			      nccip->ncci,	/* adr */
 			      (u32) skb->data,	/* Data */

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] isdn capi driver broken on 64 bit.
  2007-08-24 18:08 [PATCH] isdn capi driver broken on 64 bit Stephen Hemminger
@ 2007-08-27 11:02 ` Karsten Keil
  2007-08-27 16:16   ` Stephen Hemminger
  0 siblings, 1 reply; 3+ messages in thread
From: Karsten Keil @ 2007-08-27 11:02 UTC (permalink / raw)
  To: isdn4linux, netdev

On Fri, Aug 24, 2007 at 11:08:11AM -0700, Stephen Hemminger wrote:
> The following driver API is broken on any architecture with 64 bit addresses.
> because of cast that loses high bits.
> 
> Signed-off-by: Stephen Hemminger <shemminger@linux-foundation.org>
> 
> 
> --- a/drivers/isdn/capi/capidrv.c	2007-06-25 09:03:12.000000000 -0700
> +++ b/drivers/isdn/capi/capidrv.c	2007-08-24 11:06:46.000000000 -0700
> @@ -1855,6 +1855,9 @@ static int if_sendbuf(int id, int channe
>  		return 0;
>  	}
>  	datahandle = nccip->datahandle;
> +
> +	/* This won't work on 64 bit! */
> +	BUILD_BUG_ON(sizeof(skb->data) > sizeof(u32));
>  	capi_fill_DATA_B3_REQ(&sendcmsg, global.ap.applid, card->msgid++,
>  			      nccip->ncci,	/* adr */
>  			      (u32) skb->data,	/* Data */


NACK.

It is not a BUG.

This is OK, since this field must have a value and on 32 it has the correct
one) On 64 bit this field is ignored (but also need a value, random data is
bad as well).


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] isdn capi driver broken on 64 bit.
  2007-08-27 11:02 ` Karsten Keil
@ 2007-08-27 16:16   ` Stephen Hemminger
  0 siblings, 0 replies; 3+ messages in thread
From: Stephen Hemminger @ 2007-08-27 16:16 UTC (permalink / raw)
  To: Karsten Keil; +Cc: isdn4linux, netdev

On Mon, 27 Aug 2007 13:02:26 +0200
Karsten Keil <kkeil@suse.de> wrote:

> On Fri, Aug 24, 2007 at 11:08:11AM -0700, Stephen Hemminger wrote:
> > The following driver API is broken on any architecture with 64 bit addresses.
> > because of cast that loses high bits.
> > 
> > Signed-off-by: Stephen Hemminger <shemminger@linux-foundation.org>
> > 
> > 
> > --- a/drivers/isdn/capi/capidrv.c	2007-06-25 09:03:12.000000000 -0700
> > +++ b/drivers/isdn/capi/capidrv.c	2007-08-24 11:06:46.000000000 -0700
> > @@ -1855,6 +1855,9 @@ static int if_sendbuf(int id, int channe
> >  		return 0;
> >  	}
> >  	datahandle = nccip->datahandle;
> > +
> > +	/* This won't work on 64 bit! */
> > +	BUILD_BUG_ON(sizeof(skb->data) > sizeof(u32));
> >  	capi_fill_DATA_B3_REQ(&sendcmsg, global.ap.applid, card->msgid++,
> >  			      nccip->ncci,	/* adr */
> >  			      (u32) skb->data,	/* Data */
> 
> 
> NACK.
> 
> It is not a BUG.
> 
> This is OK, since this field must have a value and on 32 it has the correct
> one) On 64 bit this field is ignored (but also need a value, random data is
> bad as well).

If you are using it as a transaction ID, then you should generate one.
There is no guarantee that two skb's won't have the same 32 bit data value
on 64 bit.
-- 
Stephen Hemminger <shemminger@linux-foundation.org>

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2007-08-27 16:17 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-08-24 18:08 [PATCH] isdn capi driver broken on 64 bit Stephen Hemminger
2007-08-27 11:02 ` Karsten Keil
2007-08-27 16:16   ` Stephen Hemminger

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).