diff options
author | Amitkumar Karwar <akarwar@marvell.com> | 2013-10-22 18:24:43 -0400 |
---|---|---|
committer | John W. Linville <linville@tuxdriver.com> | 2013-11-11 14:38:56 -0500 |
commit | 930fd35c8de88cc1ce934aa655181c4879422a37 (patch) | |
tree | 2f1a5b3754ea80e522ee371a95cd8745c3ef39d0 /drivers/net/wireless | |
parent | 95edbc30db7882a45c4040747331cf613aa23c4a (diff) |
mwifiex: replace u16 with __le16 in struct mwifiex_types_power_group
__le16 to u16 conversion is missing for "pg_tlv_hdr->length"
in mwifiex_get_power_level(). This creates a problem on big
endian machines.
It is resolved by changing definition of the structure
and making required endianness changes.
Signed-off-by: Amitkumar Karwar <akarwar@marvell.com>
Signed-off-by: Bing Zhao <bzhao@marvell.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
Diffstat (limited to 'drivers/net/wireless')
-rw-r--r-- | drivers/net/wireless/mwifiex/fw.h | 4 | ||||
-rw-r--r-- | drivers/net/wireless/mwifiex/sta_cmd.c | 4 | ||||
-rw-r--r-- | drivers/net/wireless/mwifiex/sta_cmdresp.c | 4 | ||||
-rw-r--r-- | drivers/net/wireless/mwifiex/sta_ioctl.c | 5 |
4 files changed, 9 insertions, 8 deletions
diff --git a/drivers/net/wireless/mwifiex/fw.h b/drivers/net/wireless/mwifiex/fw.h index f80f30b6160e..c8385ec77a86 100644 --- a/drivers/net/wireless/mwifiex/fw.h +++ b/drivers/net/wireless/mwifiex/fw.h | |||
@@ -1020,8 +1020,8 @@ struct mwifiex_power_group { | |||
1020 | } __packed; | 1020 | } __packed; |
1021 | 1021 | ||
1022 | struct mwifiex_types_power_group { | 1022 | struct mwifiex_types_power_group { |
1023 | u16 type; | 1023 | __le16 type; |
1024 | u16 length; | 1024 | __le16 length; |
1025 | } __packed; | 1025 | } __packed; |
1026 | 1026 | ||
1027 | struct host_cmd_ds_txpwr_cfg { | 1027 | struct host_cmd_ds_txpwr_cfg { |
diff --git a/drivers/net/wireless/mwifiex/sta_cmd.c b/drivers/net/wireless/mwifiex/sta_cmd.c index 7d66018a2e33..2181ee283d82 100644 --- a/drivers/net/wireless/mwifiex/sta_cmd.c +++ b/drivers/net/wireless/mwifiex/sta_cmd.c | |||
@@ -239,14 +239,14 @@ static int mwifiex_cmd_tx_power_cfg(struct host_cmd_ds_command *cmd, | |||
239 | memmove(cmd_txp_cfg, txp, | 239 | memmove(cmd_txp_cfg, txp, |
240 | sizeof(struct host_cmd_ds_txpwr_cfg) + | 240 | sizeof(struct host_cmd_ds_txpwr_cfg) + |
241 | sizeof(struct mwifiex_types_power_group) + | 241 | sizeof(struct mwifiex_types_power_group) + |
242 | pg_tlv->length); | 242 | le16_to_cpu(pg_tlv->length)); |
243 | 243 | ||
244 | pg_tlv = (struct mwifiex_types_power_group *) ((u8 *) | 244 | pg_tlv = (struct mwifiex_types_power_group *) ((u8 *) |
245 | cmd_txp_cfg + | 245 | cmd_txp_cfg + |
246 | sizeof(struct host_cmd_ds_txpwr_cfg)); | 246 | sizeof(struct host_cmd_ds_txpwr_cfg)); |
247 | cmd->size = cpu_to_le16(le16_to_cpu(cmd->size) + | 247 | cmd->size = cpu_to_le16(le16_to_cpu(cmd->size) + |
248 | sizeof(struct mwifiex_types_power_group) + | 248 | sizeof(struct mwifiex_types_power_group) + |
249 | pg_tlv->length); | 249 | le16_to_cpu(pg_tlv->length)); |
250 | } else { | 250 | } else { |
251 | memmove(cmd_txp_cfg, txp, sizeof(*txp)); | 251 | memmove(cmd_txp_cfg, txp, sizeof(*txp)); |
252 | } | 252 | } |
diff --git a/drivers/net/wireless/mwifiex/sta_cmdresp.c b/drivers/net/wireless/mwifiex/sta_cmdresp.c index 58a6013712d2..bdf50fd5ef6b 100644 --- a/drivers/net/wireless/mwifiex/sta_cmdresp.c +++ b/drivers/net/wireless/mwifiex/sta_cmdresp.c | |||
@@ -340,7 +340,7 @@ static int mwifiex_get_power_level(struct mwifiex_private *priv, void *data_buf) | |||
340 | ((u8 *) data_buf + sizeof(struct host_cmd_ds_txpwr_cfg)); | 340 | ((u8 *) data_buf + sizeof(struct host_cmd_ds_txpwr_cfg)); |
341 | pg = (struct mwifiex_power_group *) | 341 | pg = (struct mwifiex_power_group *) |
342 | ((u8 *) pg_tlv_hdr + sizeof(struct mwifiex_types_power_group)); | 342 | ((u8 *) pg_tlv_hdr + sizeof(struct mwifiex_types_power_group)); |
343 | length = pg_tlv_hdr->length; | 343 | length = le16_to_cpu(pg_tlv_hdr->length); |
344 | if (length > 0) { | 344 | if (length > 0) { |
345 | max_power = pg->power_max; | 345 | max_power = pg->power_max; |
346 | min_power = pg->power_min; | 346 | min_power = pg->power_min; |
@@ -356,7 +356,7 @@ static int mwifiex_get_power_level(struct mwifiex_private *priv, void *data_buf) | |||
356 | 356 | ||
357 | length -= sizeof(struct mwifiex_power_group); | 357 | length -= sizeof(struct mwifiex_power_group); |
358 | } | 358 | } |
359 | if (pg_tlv_hdr->length > 0) { | 359 | if (le16_to_cpu(pg_tlv_hdr->length) > 0) { |
360 | priv->min_tx_power_level = (u8) min_power; | 360 | priv->min_tx_power_level = (u8) min_power; |
361 | priv->max_tx_power_level = (u8) max_power; | 361 | priv->max_tx_power_level = (u8) max_power; |
362 | } | 362 | } |
diff --git a/drivers/net/wireless/mwifiex/sta_ioctl.c b/drivers/net/wireless/mwifiex/sta_ioctl.c index f084412eee0b..c8e029df770e 100644 --- a/drivers/net/wireless/mwifiex/sta_ioctl.c +++ b/drivers/net/wireless/mwifiex/sta_ioctl.c | |||
@@ -638,8 +638,9 @@ int mwifiex_set_tx_power(struct mwifiex_private *priv, | |||
638 | txp_cfg->mode = cpu_to_le32(1); | 638 | txp_cfg->mode = cpu_to_le32(1); |
639 | pg_tlv = (struct mwifiex_types_power_group *) | 639 | pg_tlv = (struct mwifiex_types_power_group *) |
640 | (buf + sizeof(struct host_cmd_ds_txpwr_cfg)); | 640 | (buf + sizeof(struct host_cmd_ds_txpwr_cfg)); |
641 | pg_tlv->type = TLV_TYPE_POWER_GROUP; | 641 | pg_tlv->type = cpu_to_le16(TLV_TYPE_POWER_GROUP); |
642 | pg_tlv->length = 4 * sizeof(struct mwifiex_power_group); | 642 | pg_tlv->length = |
643 | cpu_to_le16(4 * sizeof(struct mwifiex_power_group)); | ||
643 | pg = (struct mwifiex_power_group *) | 644 | pg = (struct mwifiex_power_group *) |
644 | (buf + sizeof(struct host_cmd_ds_txpwr_cfg) | 645 | (buf + sizeof(struct host_cmd_ds_txpwr_cfg) |
645 | + sizeof(struct mwifiex_types_power_group)); | 646 | + sizeof(struct mwifiex_types_power_group)); |