2012-03-01 17:16:36

by santosh nayak

[permalink] [raw]
Subject: Resend: [PATCH] Bluetooth: Fix Endian Bug.

From: Santosh Nayak <[email protected]>

Fix network to host endian conversion for L2CAP chan id.

Signed-off-by: Santosh Nayak <[email protected]>
---
net/bluetooth/l2cap_sock.c | 5 +++--
1 files changed, 3 insertions(+), 2 deletions(-)

diff --git a/net/bluetooth/l2cap_sock.c b/net/bluetooth/l2cap_sock.c
index 401d942..86d5067 100644
--- a/net/bluetooth/l2cap_sock.c
+++ b/net/bluetooth/l2cap_sock.c
@@ -82,7 +82,7 @@ static int l2cap_sock_bind(struct socket *sock, struct sockaddr *addr, int alen)
}

if (la.l2_cid)
- err = l2cap_add_scid(chan, la.l2_cid);
+ err = l2cap_add_scid(chan, __le16_to_cpu(la.l2_cid));
else
err = l2cap_add_psm(chan, &la.l2_bdaddr, la.l2_psm);

@@ -123,7 +123,8 @@ static int l2cap_sock_connect(struct socket *sock, struct sockaddr *addr, int al
if (la.l2_cid && la.l2_psm)
return -EINVAL;

- err = l2cap_chan_connect(chan, la.l2_psm, la.l2_cid, &la.l2_bdaddr);
+ err = l2cap_chan_connect(chan, la.l2_psm, __le16_to_cpu(la.l2_cid),
+ &la.l2_bdaddr);
if (err)
goto done;

--
1.7.4.4


2012-03-09 12:45:19

by Gustavo Padovan

[permalink] [raw]
Subject: Re: Resend: [PATCH] Bluetooth: Fix Endian Bug.

Hi Andrei,

* santosh nayak <[email protected]> [2012-03-01 22:46:36 +0530]:

> From: Santosh Nayak <[email protected]>
>
> Fix network to host endian conversion for L2CAP chan id.
>
> Signed-off-by: Santosh Nayak <[email protected]>
> ---
> net/bluetooth/l2cap_sock.c | 5 +++--
> 1 files changed, 3 insertions(+), 2 deletions(-)

Applied, thanks.

Gustavo

2012-03-09 12:21:58

by Andrei Emeltchenko

[permalink] [raw]
Subject: Re: Resend: [PATCH] Bluetooth: Fix Endian Bug.

On Thu, Mar 01, 2012 at 10:46:36PM +0530, santosh nayak wrote:
> From: Santosh Nayak <[email protected]>
>
> Fix network to host endian conversion for L2CAP chan id.
>
> Signed-off-by: Santosh Nayak <[email protected]>

Acked-by: Andrei Emeltchenko <[email protected]>

> ---
> net/bluetooth/l2cap_sock.c | 5 +++--
> 1 files changed, 3 insertions(+), 2 deletions(-)
>
> diff --git a/net/bluetooth/l2cap_sock.c b/net/bluetooth/l2cap_sock.c
> index 401d942..86d5067 100644
> --- a/net/bluetooth/l2cap_sock.c
> +++ b/net/bluetooth/l2cap_sock.c
> @@ -82,7 +82,7 @@ static int l2cap_sock_bind(struct socket *sock, struct sockaddr *addr, int alen)
> }
>
> if (la.l2_cid)
> - err = l2cap_add_scid(chan, la.l2_cid);
> + err = l2cap_add_scid(chan, __le16_to_cpu(la.l2_cid));
> else
> err = l2cap_add_psm(chan, &la.l2_bdaddr, la.l2_psm);
>
> @@ -123,7 +123,8 @@ static int l2cap_sock_connect(struct socket *sock, struct sockaddr *addr, int al
> if (la.l2_cid && la.l2_psm)
> return -EINVAL;
>
> - err = l2cap_chan_connect(chan, la.l2_psm, la.l2_cid, &la.l2_bdaddr);
> + err = l2cap_chan_connect(chan, la.l2_psm, __le16_to_cpu(la.l2_cid),
> + &la.l2_bdaddr);
> if (err)
> goto done;
>
> --
> 1.7.4.4
>
> --
> To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
> the body of a message to [email protected]
> More majordomo info at http://vger.kernel.org/majordomo-info.html
> Please read the FAQ at http://www.tux.org/lkml/

2012-03-08 17:53:03

by Marcel Holtmann

[permalink] [raw]
Subject: Re: Resend: [PATCH] Bluetooth: Fix Endian Bug.

Hi Gustavo,

> > Fix network to host endian conversion for L2CAP chan id.
> >
> > Signed-off-by: Santosh Nayak <[email protected]>
> > ---
> > net/bluetooth/l2cap_sock.c | 5 +++--
> > 1 files changed, 3 insertions(+), 2 deletions(-)
> >
> > diff --git a/net/bluetooth/l2cap_sock.c b/net/bluetooth/l2cap_sock.c
> > index 401d942..86d5067 100644
> > --- a/net/bluetooth/l2cap_sock.c
> > +++ b/net/bluetooth/l2cap_sock.c
> > @@ -82,7 +82,7 @@ static int l2cap_sock_bind(struct socket *sock, struct sockaddr *addr, int alen)
> > }
> >
> > if (la.l2_cid)
> > - err = l2cap_add_scid(chan, la.l2_cid);
> > + err = l2cap_add_scid(chan, __le16_to_cpu(la.l2_cid));
>
> This is kind weird, la.l2_cid comes from the user, so it is already in host
> endian. No need for convertions here.

CID and PSM are provided in little endian by user space.

Regards

Marcel



2012-03-08 05:33:21

by Gustavo Padovan

[permalink] [raw]
Subject: Re: Resend: [PATCH] Bluetooth: Fix Endian Bug.

Hi Santosh,

* santosh nayak <[email protected]> [2012-03-01 22:46:36 +0530]:

> From: Santosh Nayak <[email protected]>
>
> Fix network to host endian conversion for L2CAP chan id.
>
> Signed-off-by: Santosh Nayak <[email protected]>
> ---
> net/bluetooth/l2cap_sock.c | 5 +++--
> 1 files changed, 3 insertions(+), 2 deletions(-)
>
> diff --git a/net/bluetooth/l2cap_sock.c b/net/bluetooth/l2cap_sock.c
> index 401d942..86d5067 100644
> --- a/net/bluetooth/l2cap_sock.c
> +++ b/net/bluetooth/l2cap_sock.c
> @@ -82,7 +82,7 @@ static int l2cap_sock_bind(struct socket *sock, struct sockaddr *addr, int alen)
> }
>
> if (la.l2_cid)
> - err = l2cap_add_scid(chan, la.l2_cid);
> + err = l2cap_add_scid(chan, __le16_to_cpu(la.l2_cid));

This is kind weird, la.l2_cid comes from the user, so it is already in host
endian. No need for convertions here.

Gustavo

2012-03-02 12:32:15

by Andrei Emeltchenko

[permalink] [raw]
Subject: Re: Resend: [PATCH] Bluetooth: Fix Endian Bug.

Hi Santosh,

On Thu, Mar 01, 2012 at 07:34:58PM +0530, santosh prasad nayak wrote:
> Andrei,
>
> I could not get you.
>
> Do you want me to resend the patch with subject,
> "[PATCH] Bluetooth: Fix network to host endian conversion for L2CAP
> chan id." ?

No, the main concern was your commit message which is changelog and should
come after "---" as it is shown in the example below.

> > On Thu, Mar 01, 2012 at 04:29:21PM +0530, santosh nayak wrote:
> >> From: Santosh Nayak <[email protected]>
> >>
> >> Fix for endian bug.
> >>
> >> Fix for null dereferenced removed as it is already
> >> submitted by Andrei.
> >>
> >> Signed-off-by: Santosh Nayak <[email protected]>
> >> ---
> >> ?net/bluetooth/l2cap_sock.c | ? ?5 +++--
> >> ?1 files changed, 3 insertions(+), 2 deletions(-)
> >
> > We prefer following commit log (this is the example)
> >
> > <------8<----------------------------------------------------------
> > | ?From: Santosh Nayak <[email protected]>
> > |
> > | ?Fix network to host endian conversion for L2CAP chan id.
> > |
> > | ?Signed-off-by: Santosh Nayak <[email protected]>
> > |
> > | ?---
> > | ? ? ? ? ?* v2 Fix for null dereferenced removed as it is already
> > | ? ? ? ? ?submitted by Andrei.
> > |
> > | ? ?net/bluetooth/l2cap_sock.c | ? ?5 +++--
> > | ? ?1 files changed, 3 insertions(+), 2 deletions(-)
> > |
> > <------8<----------------------------------------------------------

Best regards
Andrei Emeltchenko

2012-03-02 07:44:15

by Dan Carpenter

[permalink] [raw]
Subject: Re: Resend: [PATCH] Bluetooth: Fix Endian Bug.

When you put "Resend:" in the subject it breaks git am. Git am is
supposed to strip out the [PATCH] but the Resend confuses it.

Put the subject as:
[PATCH v3] Bluetooth: Fix Endian Bug.

regards,
dan carpenter


Attachments:
(No filename) (213.00 B)
signature.asc (836.00 B)
Digital signature
Download all attachments

2012-03-01 14:04:58

by santosh nayak

[permalink] [raw]
Subject: Re: Resend: [PATCH] Bluetooth: Fix Endian Bug.

Andrei,

I could not get you.

Do you want me to resend the patch with subject,
"[PATCH] Bluetooth: Fix network to host endian conversion for L2CAP
chan id." ?



regards
santosh




On Thu, Mar 1, 2012 at 6:05 PM, Andrei Emeltchenko
<[email protected]> wrote:
> Hi Santosh,
>
> On Thu, Mar 01, 2012 at 04:29:21PM +0530, santosh nayak wrote:
>> From: Santosh Nayak <[email protected]>
>>
>> Fix for endian bug.
>>
>> Fix for null dereferenced removed as it is already
>> submitted by Andrei.
>>
>> Signed-off-by: Santosh Nayak <[email protected]>
>> ---
>> =A0net/bluetooth/l2cap_sock.c | =A0 =A05 +++--
>> =A01 files changed, 3 insertions(+), 2 deletions(-)
>
> We prefer following commit log (this is the example)
>
> <------8<----------------------------------------------------------
> | =A0From: Santosh Nayak <[email protected]>
> |
> | =A0Fix network to host endian conversion for L2CAP chan id.
> |
> | =A0Signed-off-by: Santosh Nayak <[email protected]>
> |
> | =A0---
> | =A0 =A0 =A0 =A0 =A0* v2 Fix for null dereferenced removed as it is alre=
ady
> | =A0 =A0 =A0 =A0 =A0submitted by Andrei.
> |
> | =A0 =A0net/bluetooth/l2cap_sock.c | =A0 =A05 +++--
> | =A0 =A01 files changed, 3 insertions(+), 2 deletions(-)
> |
> <------8<----------------------------------------------------------
>
>
>>
>> diff --git a/net/bluetooth/l2cap_sock.c b/net/bluetooth/l2cap_sock.c
>> index 401d942..86d5067 100644
>> --- a/net/bluetooth/l2cap_sock.c
>> +++ b/net/bluetooth/l2cap_sock.c
>> @@ -82,7 +82,7 @@ static int l2cap_sock_bind(struct socket *sock, struct=
sockaddr *addr, int alen)
>> =A0 =A0 =A0 }
>>
>> =A0 =A0 =A0 if (la.l2_cid)
>> - =A0 =A0 =A0 =A0 =A0 =A0 err =3D l2cap_add_scid(chan, la.l2_cid);
>> + =A0 =A0 =A0 =A0 =A0 =A0 err =3D l2cap_add_scid(chan, __le16_to_cpu(la.=
l2_cid));
>> =A0 =A0 =A0 else
>> =A0 =A0 =A0 =A0 =A0 =A0 =A0 err =3D l2cap_add_psm(chan, &la.l2_bdaddr, l=
a.l2_psm);
>>
>> @@ -123,7 +123,8 @@ static int l2cap_sock_connect(struct socket *sock, s=
truct sockaddr *addr, int al
>> =A0 =A0 =A0 if (la.l2_cid && la.l2_psm)
>> =A0 =A0 =A0 =A0 =A0 =A0 =A0 return -EINVAL;
>>
>> - =A0 =A0 err =3D l2cap_chan_connect(chan, la.l2_psm, la.l2_cid, &la.l2_=
bdaddr);
>> + =A0 =A0 err =3D l2cap_chan_connect(chan, la.l2_psm, __le16_to_cpu(la.l=
2_cid),
>> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 &la.l2_bdaddr)=
;
>
> I live this to Marcel to decide should we reindent our code otherwise thi=
s
> one looks odd.
>
> Best regards
> Andrei Emeltchenko
>

2012-03-01 12:35:42

by Andrei Emeltchenko

[permalink] [raw]
Subject: Re: Resend: [PATCH] Bluetooth: Fix Endian Bug.

Hi Santosh,

On Thu, Mar 01, 2012 at 04:29:21PM +0530, santosh nayak wrote:
> From: Santosh Nayak <[email protected]>
>
> Fix for endian bug.
>
> Fix for null dereferenced removed as it is already
> submitted by Andrei.
>
> Signed-off-by: Santosh Nayak <[email protected]>
> ---
> net/bluetooth/l2cap_sock.c | 5 +++--
> 1 files changed, 3 insertions(+), 2 deletions(-)

We prefer following commit log (this is the example)

<------8<----------------------------------------------------------
| From: Santosh Nayak <[email protected]>
|
| Fix network to host endian conversion for L2CAP chan id.
|
| Signed-off-by: Santosh Nayak <[email protected]>
|
| ---
| * v2 Fix for null dereferenced removed as it is already
| submitted by Andrei.
|
| net/bluetooth/l2cap_sock.c | 5 +++--
| 1 files changed, 3 insertions(+), 2 deletions(-)
|
<------8<----------------------------------------------------------


>
> diff --git a/net/bluetooth/l2cap_sock.c b/net/bluetooth/l2cap_sock.c
> index 401d942..86d5067 100644
> --- a/net/bluetooth/l2cap_sock.c
> +++ b/net/bluetooth/l2cap_sock.c
> @@ -82,7 +82,7 @@ static int l2cap_sock_bind(struct socket *sock, struct sockaddr *addr, int alen)
> }
>
> if (la.l2_cid)
> - err = l2cap_add_scid(chan, la.l2_cid);
> + err = l2cap_add_scid(chan, __le16_to_cpu(la.l2_cid));
> else
> err = l2cap_add_psm(chan, &la.l2_bdaddr, la.l2_psm);
>
> @@ -123,7 +123,8 @@ static int l2cap_sock_connect(struct socket *sock, struct sockaddr *addr, int al
> if (la.l2_cid && la.l2_psm)
> return -EINVAL;
>
> - err = l2cap_chan_connect(chan, la.l2_psm, la.l2_cid, &la.l2_bdaddr);
> + err = l2cap_chan_connect(chan, la.l2_psm, __le16_to_cpu(la.l2_cid),
> + &la.l2_bdaddr);

I live this to Marcel to decide should we reindent our code otherwise this
one looks odd.

Best regards
Andrei Emeltchenko