Search Linux Wireless

Re: [PATCH 14/48] libertas: fix data packet size errors

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Monday 10 December 2007 16:45:48 David Woodhouse wrote:
> From: Holger Schurig <hs4233@xxxxxxxxxxxxxxxxxxxx>
> Date: Thu, 6 Dec 2007 13:50:30 +0100
> 
> I wondered about junk bytes at the end when using "lbsdebug +hex +host"
> until I noticed that firmware for the CF card sends my extranous bytes.
> It says "I have 20 bytes", I take 20 bytes, but the last 8 bytes of this
> are just data junk.
> 
> Also, in the new lbs_cmd() where was a size miscalulation
> that made itself clear after fixing this bug.
> 
> Signed-off-by: Holger Schurig <hs4233@xxxxxxxxxxxxxxxxxxxx>
> Signed-off-by: David Woodhouse <dwmw2@xxxxxxxxxxxxx>
> ---
>  drivers/net/wireless/libertas/cmdresp.c |    2 +-
>  drivers/net/wireless/libertas/if_cs.c   |    3 +++
>  2 files changed, 4 insertions(+), 1 deletions(-)
> 
> diff --git a/drivers/net/wireless/libertas/cmdresp.c b/drivers/net/wireless/libertas/cmdresp.c
> index 6a43de7..22a6973 100644
> --- a/drivers/net/wireless/libertas/cmdresp.c
> +++ b/drivers/net/wireless/libertas/cmdresp.c
> @@ -882,7 +882,7 @@ int lbs_process_rx_command(struct lbs_private *priv)
>  
>  	if (adapter->cur_cmd->pdata_size) {
>  		struct cmd_ds_gen *r = (struct cmd_ds_gen *)resp;
> -		u16 sz = cpu_to_le16(resp->size);
> +		u16 sz = cpu_to_le16(resp->size) - S_DS_GEN;

Whoops, something's wrong here.
You are subtracting from a LE value.

>  		if (sz > *adapter->cur_cmd->pdata_size) {
>  			lbs_pr_err("response 0x%04x doesn't fit into "
>  				"buffer (%d > %d)\n", respcmd,
> diff --git a/drivers/net/wireless/libertas/if_cs.c b/drivers/net/wireless/libertas/if_cs.c
> index 54b1ba3..8508260 100644
> --- a/drivers/net/wireless/libertas/if_cs.c
> +++ b/drivers/net/wireless/libertas/if_cs.c
> @@ -373,6 +373,9 @@ static int if_cs_receive_cmdres(struct lbs_private *priv, u8 *data, u32 *len)
>  	if (*len & 1)
>  		data[*len-1] = if_cs_read8(priv->card, IF_CS_C_CMD);
>  
> +	/* This is a workaround for a firmware that reports too much
> +	 * bytes */
> +	*len -= 8;
>  	ret = 0;
>  out:
>  	lbs_deb_leave_args(LBS_DEB_CS, "ret %d, len %d", ret, *len);



-- 
Greetings Michael.
-
To unsubscribe from this list: send the line "unsubscribe linux-wireless" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Linux Host AP]     [ATH6KL]     [Linux Bluetooth]     [Linux Netdev]     [Kernel Newbies]     [Linux Kernel]     [IDE]     [Security]     [Git]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux ATA RAID]     [Samba]     [Device Mapper]
  Powered by Linux