diff options
author | Dan Carpenter <dan.carpenter@oracle.com> | 2012-01-12 01:34:50 -0500 |
---|---|---|
committer | John W. Linville <linville@tuxdriver.com> | 2012-01-13 14:40:56 -0500 |
commit | 92c1ff1fa772ee76a18ae1edd2e4baecf381f17e (patch) | |
tree | 1e92c04b64bb3ac4e8d2424e854ef6e9301a8be9 | |
parent | ccde8a45cbd3ea9a6e785e4393d3a1f6b4e6b495 (diff) |
ipw2x00: signedness bug handling frame length
This is basically just a cleanup. Large positive numbers get counted as
negative but then get implicitly cast to positive again for the checks
that matter.
This does make a small difference in ipw_handle_promiscuous_rx() when we
test "if (unlikely((len + IPW_RX_FRAME_SIZE) > skb_tailroom(rxb->skb)))"
It should return there, but we don't return until a couple lines later
when we test "if (len > IPW_RX_BUF_SIZE - sizeof(struct ipw_rt_hdr)) {".
The difference is that in the second test the sizeof() means that there
is an implied cast to unsigned.
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Reviewed-by: Stanislaw Gruszka <sgruszka@redhat.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
-rw-r--r-- | drivers/net/wireless/ipw2x00/ipw2200.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/drivers/net/wireless/ipw2x00/ipw2200.c b/drivers/net/wireless/ipw2x00/ipw2200.c index 018a8deb88a8..4fcdac63a300 100644 --- a/drivers/net/wireless/ipw2x00/ipw2200.c +++ b/drivers/net/wireless/ipw2x00/ipw2200.c | |||
@@ -7848,7 +7848,7 @@ static void ipw_handle_data_packet_monitor(struct ipw_priv *priv, | |||
7848 | * more efficiently than we can parse it. ORDER MATTERS HERE */ | 7848 | * more efficiently than we can parse it. ORDER MATTERS HERE */ |
7849 | struct ipw_rt_hdr *ipw_rt; | 7849 | struct ipw_rt_hdr *ipw_rt; |
7850 | 7850 | ||
7851 | short len = le16_to_cpu(pkt->u.frame.length); | 7851 | unsigned short len = le16_to_cpu(pkt->u.frame.length); |
7852 | 7852 | ||
7853 | /* We received data from the HW, so stop the watchdog */ | 7853 | /* We received data from the HW, so stop the watchdog */ |
7854 | dev->trans_start = jiffies; | 7854 | dev->trans_start = jiffies; |
@@ -8023,7 +8023,7 @@ static void ipw_handle_promiscuous_rx(struct ipw_priv *priv, | |||
8023 | s8 signal = frame->rssi_dbm - IPW_RSSI_TO_DBM; | 8023 | s8 signal = frame->rssi_dbm - IPW_RSSI_TO_DBM; |
8024 | s8 noise = (s8) le16_to_cpu(frame->noise); | 8024 | s8 noise = (s8) le16_to_cpu(frame->noise); |
8025 | u8 rate = frame->rate; | 8025 | u8 rate = frame->rate; |
8026 | short len = le16_to_cpu(pkt->u.frame.length); | 8026 | unsigned short len = le16_to_cpu(pkt->u.frame.length); |
8027 | struct sk_buff *skb; | 8027 | struct sk_buff *skb; |
8028 | int hdr_only = 0; | 8028 | int hdr_only = 0; |
8029 | u16 filter = priv->prom_priv->filter; | 8029 | u16 filter = priv->prom_priv->filter; |