diff options
-rw-r--r-- | drivers/net/wireless/ipw2200.c | 23 |
1 files changed, 12 insertions, 11 deletions
diff --git a/drivers/net/wireless/ipw2200.c b/drivers/net/wireless/ipw2200.c index 79d1a13ab72c..11730448a821 100644 --- a/drivers/net/wireless/ipw2200.c +++ b/drivers/net/wireless/ipw2200.c | |||
@@ -3107,10 +3107,10 @@ static int ipw_reset_nic(struct ipw_priv *priv) | |||
3107 | 3107 | ||
3108 | 3108 | ||
3109 | struct ipw_fw { | 3109 | struct ipw_fw { |
3110 | u32 ver; | 3110 | __le32 ver; |
3111 | u32 boot_size; | 3111 | __le32 boot_size; |
3112 | u32 ucode_size; | 3112 | __le32 ucode_size; |
3113 | u32 fw_size; | 3113 | __le32 fw_size; |
3114 | u8 data[0]; | 3114 | u8 data[0]; |
3115 | }; | 3115 | }; |
3116 | 3116 | ||
@@ -3134,8 +3134,8 @@ static int ipw_get_fw(struct ipw_priv *priv, | |||
3134 | 3134 | ||
3135 | fw = (void *)(*raw)->data; | 3135 | fw = (void *)(*raw)->data; |
3136 | 3136 | ||
3137 | if ((*raw)->size < sizeof(*fw) + | 3137 | if ((*raw)->size < sizeof(*fw) + le32_to_cpu(fw->boot_size) + |
3138 | fw->boot_size + fw->ucode_size + fw->fw_size) { | 3138 | le32_to_cpu(fw->ucode_size) + le32_to_cpu(fw->fw_size)) { |
3139 | IPW_ERROR("%s is too small or corrupt (%zd)\n", | 3139 | IPW_ERROR("%s is too small or corrupt (%zd)\n", |
3140 | name, (*raw)->size); | 3140 | name, (*raw)->size); |
3141 | return -EINVAL; | 3141 | return -EINVAL; |
@@ -3240,8 +3240,9 @@ static int ipw_load(struct ipw_priv *priv) | |||
3240 | 3240 | ||
3241 | fw = (void *)raw->data; | 3241 | fw = (void *)raw->data; |
3242 | boot_img = &fw->data[0]; | 3242 | boot_img = &fw->data[0]; |
3243 | ucode_img = &fw->data[fw->boot_size]; | 3243 | ucode_img = &fw->data[le32_to_cpu(fw->boot_size)]; |
3244 | fw_img = &fw->data[fw->boot_size + fw->ucode_size]; | 3244 | fw_img = &fw->data[le32_to_cpu(fw->boot_size) + |
3245 | le32_to_cpu(fw->ucode_size)]; | ||
3245 | 3246 | ||
3246 | if (rc < 0) | 3247 | if (rc < 0) |
3247 | goto error; | 3248 | goto error; |
@@ -3275,7 +3276,7 @@ static int ipw_load(struct ipw_priv *priv) | |||
3275 | IPW_NIC_SRAM_UPPER_BOUND - IPW_NIC_SRAM_LOWER_BOUND); | 3276 | IPW_NIC_SRAM_UPPER_BOUND - IPW_NIC_SRAM_LOWER_BOUND); |
3276 | 3277 | ||
3277 | /* DMA the initial boot firmware into the device */ | 3278 | /* DMA the initial boot firmware into the device */ |
3278 | rc = ipw_load_firmware(priv, boot_img, fw->boot_size); | 3279 | rc = ipw_load_firmware(priv, boot_img, le32_to_cpu(fw->boot_size)); |
3279 | if (rc < 0) { | 3280 | if (rc < 0) { |
3280 | IPW_ERROR("Unable to load boot firmware: %d\n", rc); | 3281 | IPW_ERROR("Unable to load boot firmware: %d\n", rc); |
3281 | goto error; | 3282 | goto error; |
@@ -3297,7 +3298,7 @@ static int ipw_load(struct ipw_priv *priv) | |||
3297 | ipw_write32(priv, IPW_INTA_RW, IPW_INTA_BIT_FW_INITIALIZATION_DONE); | 3298 | ipw_write32(priv, IPW_INTA_RW, IPW_INTA_BIT_FW_INITIALIZATION_DONE); |
3298 | 3299 | ||
3299 | /* DMA the ucode into the device */ | 3300 | /* DMA the ucode into the device */ |
3300 | rc = ipw_load_ucode(priv, ucode_img, fw->ucode_size); | 3301 | rc = ipw_load_ucode(priv, ucode_img, le32_to_cpu(fw->ucode_size)); |
3301 | if (rc < 0) { | 3302 | if (rc < 0) { |
3302 | IPW_ERROR("Unable to load ucode: %d\n", rc); | 3303 | IPW_ERROR("Unable to load ucode: %d\n", rc); |
3303 | goto error; | 3304 | goto error; |
@@ -3307,7 +3308,7 @@ static int ipw_load(struct ipw_priv *priv) | |||
3307 | ipw_stop_nic(priv); | 3308 | ipw_stop_nic(priv); |
3308 | 3309 | ||
3309 | /* DMA bss firmware into the device */ | 3310 | /* DMA bss firmware into the device */ |
3310 | rc = ipw_load_firmware(priv, fw_img, fw->fw_size); | 3311 | rc = ipw_load_firmware(priv, fw_img, le32_to_cpu(fw->fw_size)); |
3311 | if (rc < 0) { | 3312 | if (rc < 0) { |
3312 | IPW_ERROR("Unable to load firmware: %d\n", rc); | 3313 | IPW_ERROR("Unable to load firmware: %d\n", rc); |
3313 | goto error; | 3314 | goto error; |