public inbox for kernel-janitors@vger.kernel.org
 help / color / mirror / Atom feed
* [patch] Staging: rtl8192e: off by one in rtl8192_get_channel_map()
@ 2011-09-21  7:17 Dan Carpenter
  2011-09-21 15:33 ` Larry Finger
  2011-09-21 16:25 ` Larry Finger
  0 siblings, 2 replies; 3+ messages in thread
From: Dan Carpenter @ 2011-09-21  7:17 UTC (permalink / raw)
  To: kernel-janitors

COUNTRY_CODE_MAX is not a valid country code.  We're off by one here.
This gets passed to Dot11d_Channelmap() where it's used as an offset
into the ChannelPlan[] array.

Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>

diff --git a/drivers/staging/rtl8192e/rtl_core.c b/drivers/staging/rtl8192e/rtl_core.c
index 6530058..1beb04f 100644
--- a/drivers/staging/rtl8192e/rtl_core.c
+++ b/drivers/staging/rtl8192e/rtl_core.c
@@ -1308,7 +1308,7 @@ static short rtl8192_get_channel_map(struct net_device *dev)
 		return -1;
 	}
 
-	if (priv->ChannelPlan > COUNTRY_CODE_MAX) {
+	if (priv->ChannelPlan >= COUNTRY_CODE_MAX) {
 		printk(KERN_INFO "rtl819x_init:Error channel plan! Set to "
 		       "default.\n");
 		priv->ChannelPlan = COUNTRY_CODE_FCC;

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

* Re: [patch] Staging: rtl8192e: off by one in rtl8192_get_channel_map()
  2011-09-21  7:17 [patch] Staging: rtl8192e: off by one in rtl8192_get_channel_map() Dan Carpenter
@ 2011-09-21 15:33 ` Larry Finger
  2011-09-21 16:25 ` Larry Finger
  1 sibling, 0 replies; 3+ messages in thread
From: Larry Finger @ 2011-09-21 15:33 UTC (permalink / raw)
  To: kernel-janitors

On 09/21/2011 02:17 AM, Dan Carpenter wrote:
> COUNTRY_CODE_MAX is not a valid country code.  We're off by one here.
> This gets passed to Dot11d_Channelmap() where it's used as an offset
> into the ChannelPlan[] array.
>
> Signed-off-by: Dan Carpenter<dan.carpenter@oracle.com>

Signed-off-by: Larry Finger <Larry.Finger@lwfinger.net>

Dan, good catch.  Did this cause a problem, or did you find it while reading the 
code?

Larry


>
> diff --git a/drivers/staging/rtl8192e/rtl_core.c b/drivers/staging/rtl8192e/rtl_core.c
> index 6530058..1beb04f 100644
> --- a/drivers/staging/rtl8192e/rtl_core.c
> +++ b/drivers/staging/rtl8192e/rtl_core.c
> @@ -1308,7 +1308,7 @@ static short rtl8192_get_channel_map(struct net_device *dev)
>   		return -1;
>   	}
>
> -	if (priv->ChannelPlan>  COUNTRY_CODE_MAX) {
> +	if (priv->ChannelPlan>= COUNTRY_CODE_MAX) {
>   		printk(KERN_INFO "rtl819x_init:Error channel plan! Set to "
>   		       "default.\n");
>   		priv->ChannelPlan = COUNTRY_CODE_FCC;
>


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

* Re: [patch] Staging: rtl8192e: off by one in rtl8192_get_channel_map()
  2011-09-21  7:17 [patch] Staging: rtl8192e: off by one in rtl8192_get_channel_map() Dan Carpenter
  2011-09-21 15:33 ` Larry Finger
@ 2011-09-21 16:25 ` Larry Finger
  1 sibling, 0 replies; 3+ messages in thread
From: Larry Finger @ 2011-09-21 16:25 UTC (permalink / raw)
  To: kernel-janitors

On 09/21/2011 10:45 AM, Dan Carpenter wrote:
>
> It was a Smatch thing.  I caught it when I updated my smatch_data/.

I guess I also need to update smatch.

Larry


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

end of thread, other threads:[~2011-09-21 16:25 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-09-21  7:17 [patch] Staging: rtl8192e: off by one in rtl8192_get_channel_map() Dan Carpenter
2011-09-21 15:33 ` Larry Finger
2011-09-21 16:25 ` Larry Finger

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