public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Marcel Holtmann <marcel@holtmann.org>
To: Al Viro <viro@ftp.linux.org.uk>
Cc: Linus Torvalds <torvalds@osdl.org>,
	davem@davemloft.net, linux-kernel@vger.kernel.org
Subject: Re: [PATCH 1/4] l2cap endianness annotations
Date: Mon, 16 Oct 2006 01:39:03 +0200	[thread overview]
Message-ID: <1160955543.14340.21.camel@localhost> (raw)
In-Reply-To: <20061015212905.GR29920@ftp.linux.org.uk>

Hi Al,

> @@ -34,7 +34,7 @@ #define L2CAP_CONN_TIMEOUT	(HZ * 40)
>  /* L2CAP socket address */
>  struct sockaddr_l2 {
>  	sa_family_t	l2_family;
> -	unsigned short	l2_psm;
> +	__le16		l2_psm;
>  	bdaddr_t	l2_bdaddr;
>  };

this data structure is visible to the userspace (via the Bluetooth
library headers). Do we annotate them, too?

> @@ -205,7 +205,7 @@ #define l2cap_pi(sk) ((struct l2cap_pinf
>  
>  struct l2cap_pinfo {
>  	struct bt_sock	bt;
> -	__u16		psm;
> +	__le16		psm;
>  	__u16		dcid;
>  	__u16		scid;
>  
> @@ -221,7 +221,7 @@ struct l2cap_pinfo {
>  
>  	__u8		ident;
>  
> -	__u16		sport;
> +	__le16		sport;
>  
>  	struct l2cap_conn	*conn;
>  	struct sock		*next_c;

These are internal. We should have to annotate them. They should store
it in host order. If not, than that is the problem.

> @@ -1533,7 +1533,7 @@ static inline int l2cap_config_req(struc
>  	if (!(sk = l2cap_get_chan_by_scid(&conn->chan_list, dcid)))
>  		return -ENOENT;
>  
> -	l2cap_parse_conf_req(sk, req->data, cmd->len - sizeof(*req));
> +	l2cap_parse_conf_req(sk, req->data, __le16_to_cpu(cmd->len) - sizeof(*req));

I have to look into this change. It basically means that this code never
worked on big endian systems, but it actually does.

Regards

Marcel



  reply	other threads:[~2006-10-15 23:39 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-10-15 21:29 [PATCH 1/4] l2cap endianness annotations Al Viro
2006-10-15 23:39 ` Marcel Holtmann [this message]
2006-10-15 23:49   ` Al Viro
2006-10-16  0:12   ` Al Viro

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1160955543.14340.21.camel@localhost \
    --to=marcel@holtmann.org \
    --cc=davem@davemloft.net \
    --cc=linux-kernel@vger.kernel.org \
    --cc=torvalds@osdl.org \
    --cc=viro@ftp.linux.org.uk \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox