staging: vt6656: vnt_rf_setpower rate <= RATE_11M check array bound
authorMalcolm Priestley <tvboxspy@gmail.com>
Sat, 5 Jul 2014 18:24:22 +0000 (19:24 +0100)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Tue, 8 Jul 2014 23:03:57 +0000 (16:03 -0700)
decrement channel by one and check array bound.

Signed-off-by: Malcolm Priestley <tvboxspy@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/staging/vt6656/rf.c

index 971f84480117945b37d53590f52e7b05faee9b2a..4124131fba20fe6549c31c3038866dfe5a77b0e9 100644 (file)
@@ -744,7 +744,10 @@ int vnt_rf_setpower(struct vnt_private *priv, u32 rate, u32 channel)
        case RATE_2M:
        case RATE_5M:
        case RATE_11M:
-               power = priv->abyCCKPwrTbl[channel-1];
+               channel--;
+
+               if (channel < sizeof(priv->abyCCKPwrTbl))
+                       power = priv->abyCCKPwrTbl[channel];
                break;
        case RATE_6M:
        case RATE_9M: