linux-bluetooth.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [patch] l2cap: fix signedness bugs
@ 2010-07-17 17:05 Dan Carpenter
  2010-07-17 17:51 ` Gustavo F. Padovan
  0 siblings, 1 reply; 2+ messages in thread
From: Dan Carpenter @ 2010-07-17 17:05 UTC (permalink / raw)
  To: Marcel Holtmann
  Cc: David S. Miller, Gustavo F. Padovan, João Paulo Rechi Vita,
	linux-bluetooth, kernel-janitors

These variables are only used for math.  They should be from -63 to +63.
In the original code instead of being negative they would be largish
positive numbers.  I changed them to ints.

Signed-off-by: Dan Carpenter <error27@gmail.com>

diff --git a/net/bluetooth/l2cap.c b/net/bluetooth/l2cap.c
index 1b682a5..4a13499 100644
--- a/net/bluetooth/l2cap.c
+++ b/net/bluetooth/l2cap.c
@@ -3795,7 +3795,7 @@ static inline int l2cap_data_channel_iframe(struct sock *sk, u16 rx_control, str
 	u8 tx_seq = __get_txseq(rx_control);
 	u8 req_seq = __get_reqseq(rx_control);
 	u8 sar = rx_control >> L2CAP_CTRL_SAR_SHIFT;
-	u8 tx_seq_offset, expected_tx_seq_offset;
+	int tx_seq_offset, expected_tx_seq_offset;
 	int num_to_ack = (pi->tx_win/6) + 1;
 	int err = 0;
 
@@ -4080,7 +4080,7 @@ static inline int l2cap_data_channel(struct l2cap_conn *conn, u16 cid, struct sk
 	struct sock *sk;
 	struct l2cap_pinfo *pi;
 	u16 control, len;
-	u8 tx_seq, req_seq, next_tx_seq_offset, req_seq_offset;
+	int tx_seq, req_seq, next_tx_seq_offset, req_seq_offset;
 
 	sk = l2cap_get_chan_by_scid(&conn->chan_list, cid);
 	if (!sk) {

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

* Re: [patch] l2cap: fix signedness bugs
  2010-07-17 17:05 [patch] l2cap: fix signedness bugs Dan Carpenter
@ 2010-07-17 17:51 ` Gustavo F. Padovan
  0 siblings, 0 replies; 2+ messages in thread
From: Gustavo F. Padovan @ 2010-07-17 17:51 UTC (permalink / raw)
  To: Dan Carpenter
  Cc: Marcel Holtmann, David S. Miller, Gustavo F. Padovan,
	João Paulo Rechi Vita, linux-bluetooth, kernel-janitors

Hi Dan,

* Dan Carpenter <error27@gmail.com> [2010-07-17 19:05:48 +0200]:

> These variables are only used for math.  They should be from -63 to +63.
> In the original code instead of being negative they would be largish
> positive numbers.  I changed them to ints.
> 
> Signed-off-by: Dan Carpenter <error27@gmail.com>
> 
> diff --git a/net/bluetooth/l2cap.c b/net/bluetooth/l2cap.c
> index 1b682a5..4a13499 100644
> --- a/net/bluetooth/l2cap.c
> +++ b/net/bluetooth/l2cap.c
> @@ -3795,7 +3795,7 @@ static inline int l2cap_data_channel_iframe(struct sock *sk, u16 rx_control, str
>  	u8 tx_seq = __get_txseq(rx_control);
>  	u8 req_seq = __get_reqseq(rx_control);
>  	u8 sar = rx_control >> L2CAP_CTRL_SAR_SHIFT;
> -	u8 tx_seq_offset, expected_tx_seq_offset;
> +	int tx_seq_offset, expected_tx_seq_offset;
>  	int num_to_ack = (pi->tx_win/6) + 1;
>  	int err = 0;
>  
> @@ -4080,7 +4080,7 @@ static inline int l2cap_data_channel(struct l2cap_conn *conn, u16 cid, struct sk
>  	struct sock *sk;
>  	struct l2cap_pinfo *pi;
>  	u16 control, len;
> -	u8 tx_seq, req_seq, next_tx_seq_offset, req_seq_offset;
> +	int tx_seq, req_seq, next_tx_seq_offset, req_seq_offset;
>  
>  	sk = l2cap_get_chan_by_scid(&conn->chan_list, cid);
>  	if (!sk) {

I fixed this already. Thanks.

-- 
Gustavo F. Padovan
http://padovan.org

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

end of thread, other threads:[~2010-07-17 17:51 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-07-17 17:05 [patch] l2cap: fix signedness bugs Dan Carpenter
2010-07-17 17:51 ` Gustavo F. Padovan

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).