Linux wireless drivers development
 help / color / mirror / Atom feed
* [PATCH] libertas: un-garbage various command structs
@ 2008-04-09  8:23 Holger Schurig
  2008-04-09 16:13 ` Dan Williams
  0 siblings, 1 reply; 2+ messages in thread
From: Holger Schurig @ 2008-04-09  8:23 UTC (permalink / raw)
  To: libertas-dev; +Cc: Dan Williams, linux-wireless, John W. Linville

Some command structs contain reserved or unused fields, which the driver
send uninitialized down to the card.

Signed-off-by: Holger Schurig <hs4233@mail.mn-solutions.de>

Index: wireless-testing/drivers/net/wireless/libertas/cmd.c
===================================================================
--- wireless-testing.orig/drivers/net/wireless/libertas/cmd.c	2008-04-08 18:45:29.000000000 +0200
+++ wireless-testing/drivers/net/wireless/libertas/cmd.c	2008-04-08 20:05:11.000000000 +0200
@@ -296,6 +296,7 @@ int lbs_cmd_802_11_set_wep(struct lbs_pr
 
 	lbs_deb_enter(LBS_DEB_CMD);
 
+	memset(&cmd, 0, sizeof(cmd));
 	cmd.hdr.command = cpu_to_le16(CMD_802_11_SET_WEP);
 	cmd.hdr.size = cpu_to_le16(sizeof(cmd));
 
@@ -359,7 +360,9 @@ int lbs_cmd_802_11_enable_rsn(struct lbs
 	cmd.hdr.size = cpu_to_le16(sizeof(cmd));
 	cmd.action = cpu_to_le16(cmd_action);
 
-	if (cmd_action == CMD_ACT_SET) {
+	if (cmd_action == CMD_ACT_GET)
+		cmd.enable = 0;
+	else {
 		if (*enable)
 			cmd.enable = cpu_to_le16(CMD_ENABLE_RSN);
 		else
@@ -811,6 +814,7 @@ int lbs_get_channel(struct lbs_private *
 
 	lbs_deb_enter(LBS_DEB_CMD);
 
+	memset(&cmd, 0, sizeof(cmd));
 	cmd.hdr.size = cpu_to_le16(sizeof(cmd));
 	cmd.action = cpu_to_le16(CMD_OPT_802_11_RF_CHANNEL_GET);
 
@@ -858,6 +862,7 @@ int lbs_set_channel(struct lbs_private *
 
 	lbs_deb_enter(LBS_DEB_CMD);
 
+	memset(&cmd, 0, sizeof(cmd));
 	cmd.hdr.size = cpu_to_le16(sizeof(cmd));
 	cmd.action = cpu_to_le16(CMD_OPT_802_11_RF_CHANNEL_SET);
 	cmd.channel = cpu_to_le16(channel);

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [PATCH] libertas: un-garbage various command structs
  2008-04-09  8:23 [PATCH] libertas: un-garbage various command structs Holger Schurig
@ 2008-04-09 16:13 ` Dan Williams
  0 siblings, 0 replies; 2+ messages in thread
From: Dan Williams @ 2008-04-09 16:13 UTC (permalink / raw)
  To: Holger Schurig; +Cc: libertas-dev, linux-wireless, John W. Linville

On Wed, 2008-04-09 at 10:23 +0200, Holger Schurig wrote:
> Some command structs contain reserved or unused fields, which the driver
> send uninitialized down to the card.
> 
> Signed-off-by: Holger Schurig <hs4233@mail.mn-solutions.de>

Acked-by: Dan Williams <dcbw@redhat.com>

> Index: wireless-testing/drivers/net/wireless/libertas/cmd.c
> ===================================================================
> --- wireless-testing.orig/drivers/net/wireless/libertas/cmd.c	2008-04-08 18:45:29.000000000 +0200
> +++ wireless-testing/drivers/net/wireless/libertas/cmd.c	2008-04-08 20:05:11.000000000 +0200
> @@ -296,6 +296,7 @@ int lbs_cmd_802_11_set_wep(struct lbs_pr
>  
>  	lbs_deb_enter(LBS_DEB_CMD);
>  
> +	memset(&cmd, 0, sizeof(cmd));
>  	cmd.hdr.command = cpu_to_le16(CMD_802_11_SET_WEP);
>  	cmd.hdr.size = cpu_to_le16(sizeof(cmd));
>  
> @@ -359,7 +360,9 @@ int lbs_cmd_802_11_enable_rsn(struct lbs
>  	cmd.hdr.size = cpu_to_le16(sizeof(cmd));
>  	cmd.action = cpu_to_le16(cmd_action);
>  
> -	if (cmd_action == CMD_ACT_SET) {
> +	if (cmd_action == CMD_ACT_GET)
> +		cmd.enable = 0;
> +	else {
>  		if (*enable)
>  			cmd.enable = cpu_to_le16(CMD_ENABLE_RSN);
>  		else
> @@ -811,6 +814,7 @@ int lbs_get_channel(struct lbs_private *
>  
>  	lbs_deb_enter(LBS_DEB_CMD);
>  
> +	memset(&cmd, 0, sizeof(cmd));
>  	cmd.hdr.size = cpu_to_le16(sizeof(cmd));
>  	cmd.action = cpu_to_le16(CMD_OPT_802_11_RF_CHANNEL_GET);
>  
> @@ -858,6 +862,7 @@ int lbs_set_channel(struct lbs_private *
>  
>  	lbs_deb_enter(LBS_DEB_CMD);
>  
> +	memset(&cmd, 0, sizeof(cmd));
>  	cmd.hdr.size = cpu_to_le16(sizeof(cmd));
>  	cmd.action = cpu_to_le16(CMD_OPT_802_11_RF_CHANNEL_SET);
>  	cmd.channel = cpu_to_le16(channel);


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2008-04-09 16:20 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-04-09  8:23 [PATCH] libertas: un-garbage various command structs Holger Schurig
2008-04-09 16:13 ` Dan Williams

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox