staging: r8188eu: Fix Smatch off-by-one warning in hal/rtl8188e_hal_init.c
authorLarry Finger <Larry.Finger@lwfinger.net>
Wed, 4 Sep 2013 20:55:53 +0000 (15:55 -0500)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Tue, 17 Sep 2013 14:47:44 +0000 (07:47 -0700)
commit5e994b0e6407f7b3be85f112dce2342a07fc9a36
tree7dd10550cc51eb6dc960bb5a1d0f51e5726e7c36
parent462035531e1363f8be117de6d812586e91444f37
staging: r8188eu: Fix Smatch off-by-one warning in hal/rtl8188e_hal_init.c

Smatch reports the following warning:
"drivers/staging/rtl8188eu/hal/rtl8188e_hal_init.c:2008
Hal_ReadPowerValueFromPROM_8188E()
 error: buffer overflow 'pwrInfo24G->IndexBW40_Base[rfPath]' 5 <= 5"

drivers/staging/rtl8188eu/hal/rtl8188e_hal_init.c
  2005                          /* 2.4G default value */
  2006                          for (group = 0; group < MAX_CHNL_GROUP_24G; group++) {
  2007                                  pwrInfo24G->IndexCCK_Base[rfPath][group] =      EEPROM_DEFAULT_24G_INDEX;
  2008                                  pwrInfo24G->IndexBW40_Base[rfPath][group] =     EEPROM_DEFAULT_24G_INDEX;

The reason is that IndexCCK_Base[] has MAX_CHNL_GROUP_24G elements, but
IndexBW40_Base is smaller by 1. Make them both have MAX_CHNL_GROUP_24G
elements.

Reported by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Larry Finger <Larry.Finger@lwfinger.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/staging/rtl8188eu/include/rtl8188e_hal.h