public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Al Viro <viro@ftp.linux.org.uk>
To: Marcel Holtmann <marcel@holtmann.org>
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:12:14 +0100	[thread overview]
Message-ID: <20061016001214.GA29920@ftp.linux.org.uk> (raw)
In-Reply-To: <1160955543.14340.21.camel@localhost>

On Mon, Oct 16, 2006 at 01:39:03AM +0200, Marcel Holtmann wrote:
> > @@ -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.

BTW, I would leave ->psm is wire order; we compare it to ->l2_psm from
sockaddr_l2 a lot, so putting a conversion there looks odd.

Note that we do pass ->ls_psm to __l2cap_sock_by_addr(), so I'm not sure
if I like the idea of host-endian ->sport; we would need to slap a conversion
there as well.

See also
                bacpy(&bt_sk(sk)->src, &la->l2_bdaddr);
                l2cap_pi(sk)->psm   = la->l2_psm;
                l2cap_pi(sk)->sport = la->l2_psm;
                sk->sk_state = BT_BOUND;
for other place where net-endian gets there.

Are you sure that you want both to be switched to host-endian?

      parent reply	other threads:[~2006-10-16  0:12 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
2006-10-15 23:49   ` Al Viro
2006-10-16  0:12   ` Al Viro [this message]

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=20061016001214.GA29920@ftp.linux.org.uk \
    --to=viro@ftp.linux.org.uk \
    --cc=davem@davemloft.net \
    --cc=linux-kernel@vger.kernel.org \
    --cc=marcel@holtmann.org \
    --cc=torvalds@osdl.org \
    /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