diff options
Diffstat (limited to 'drivers/net/wireless/libertas/fw.c')
-rw-r--r-- | drivers/net/wireless/libertas/fw.c | 13 |
1 files changed, 7 insertions, 6 deletions
diff --git a/drivers/net/wireless/libertas/fw.c b/drivers/net/wireless/libertas/fw.c index 5463ee618a19..2dc84ff7a54a 100644 --- a/drivers/net/wireless/libertas/fw.c +++ b/drivers/net/wireless/libertas/fw.c | |||
@@ -19,7 +19,7 @@ | |||
19 | */ | 19 | */ |
20 | static int check_fwfile_format(u8 *data, u32 totlen) | 20 | static int check_fwfile_format(u8 *data, u32 totlen) |
21 | { | 21 | { |
22 | u8 bincmd, exit; | 22 | u32 bincmd, exit; |
23 | u32 blksize, offset, len; | 23 | u32 blksize, offset, len; |
24 | int ret; | 24 | int ret; |
25 | 25 | ||
@@ -27,8 +27,10 @@ static int check_fwfile_format(u8 *data, u32 totlen) | |||
27 | exit = len = 0; | 27 | exit = len = 0; |
28 | 28 | ||
29 | do { | 29 | do { |
30 | bincmd = *data; | 30 | struct fwheader *fwh = (void *)data; |
31 | blksize = *(u32*)(data + offsetof(struct fwheader, datalength)); | 31 | |
32 | bincmd = le32_to_cpu(fwh->dnldcmd); | ||
33 | blksize = le32_to_cpu(fwh->datalength); | ||
32 | switch (bincmd) { | 34 | switch (bincmd) { |
33 | case FW_HAS_DATA_TO_RECV: | 35 | case FW_HAS_DATA_TO_RECV: |
34 | offset = sizeof(struct fwheader) + blksize; | 36 | offset = sizeof(struct fwheader) + blksize; |
@@ -72,13 +74,12 @@ static int wlan_setup_station_hw(wlan_private * priv, char *fw_name) | |||
72 | 74 | ||
73 | if ((ret = request_firmware(&priv->firmware, fw_name, | 75 | if ((ret = request_firmware(&priv->firmware, fw_name, |
74 | priv->hotplug_device)) < 0) { | 76 | priv->hotplug_device)) < 0) { |
75 | lbs_pr_err("request_firmware() failed with %#x\n", | 77 | lbs_pr_err("request_firmware() failed with %#x\n", ret); |
76 | ret); | ||
77 | lbs_pr_err("firmware %s not found\n", fw_name); | 78 | lbs_pr_err("firmware %s not found\n", fw_name); |
78 | goto done; | 79 | goto done; |
79 | } | 80 | } |
80 | 81 | ||
81 | if(check_fwfile_format(priv->firmware->data, priv->firmware->size)) { | 82 | if (check_fwfile_format(priv->firmware->data, priv->firmware->size)) { |
82 | release_firmware(priv->firmware); | 83 | release_firmware(priv->firmware); |
83 | goto done; | 84 | goto done; |
84 | } | 85 | } |