staging: r8188eu: Fix compiler warnings in os_dep/ioctl_linux.c
authorLarry Finger <Larry.Finger@lwfinger.net>
Thu, 29 Aug 2013 02:12:25 +0000 (21:12 -0500)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Fri, 30 Aug 2013 18:46:46 +0000 (11:46 -0700)
The 0-DAY kernel build testing backend reports the following compiler
warnings not shown on my compiler version/options:

   drivers/staging/rtl8188eu/os_dep/ioctl_linux.c: In function 'rtw_mp_efuse_get':
>> drivers/staging/rtl8188eu/os_dep/ioctl_linux.c:5836:65: warning: iteration 16u invokes undefined behavior [-Waggressive-loop-optimizations]
        sprintf(extra, "%s%02X ", extra, pEfuseHal->fakeEfuseInitMap[i+j]);
                                                                    ^
   drivers/staging/rtl8188eu/os_dep/ioctl_linux.c:5830:3: note: containing loop
      for (i = 0; i < EFUSE_MAP_SIZE; i += 16) {
      ^
>> drivers/staging/rtl8188eu/os_dep/ioctl_linux.c:6042:69: warning: iteration 16u invokes undefined behavior [-Waggressive-loop-optimizations]
        sprintf(extra, "%s %02X", extra, pEfuseHal->fakeEfuseModifiedMap[i+j]);
                                                                        ^
   drivers/staging/rtl8188eu/os_dep/ioctl_linux.c:6036:3: note: containing loop
      for (i = 0; i < EFUSE_MAP_SIZE; i += 16) {
      ^

The problem is due to improper settings for some of the EFUSE_XXX defines such that
EFUSE_MAP_SIZE was larger than the sizes of the marked arrays. Thanks to
Fengguang Wu for helping me understand the root cause.

Reported-by: Fengguang Wu <fengguang.wu@intel.com>
Signed-off-by: Larry Finger <Larry.Finger@lwfinger.net>
Cc: Fengguang Wu <fengguang.wu@intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/staging/rtl8188eu/include/rtl8188e_hal.h
drivers/staging/rtl8188eu/include/rtw_efuse.h

index fc4adb614bfede64b65ca83821a846cd9d839b3e..52b280165a926da8acccb981e539c787c6c422b9 100644 (file)
@@ -197,7 +197,6 @@ struct txpowerinfo24g {
 };
 
 #define EFUSE_REAL_CONTENT_LEN         512
-#define EFUSE_MAP_LEN                  128
 #define EFUSE_MAX_SECTION              16
 #define EFUSE_IC_ID_OFFSET             506 /* For some inferior IC purpose*/
 #define AVAILABLE_EFUSE_ADDR(addr)     (addr < EFUSE_REAL_CONTENT_LEN)
@@ -215,6 +214,7 @@ struct txpowerinfo24g {
 
 #define                EFUSE_REAL_CONTENT_LEN_88E      256
 #define                EFUSE_MAP_LEN_88E               512
+#define EFUSE_MAP_LEN                  EFUSE_MAP_LEN_88E
 #define                EFUSE_MAX_SECTION_88E           64
 #define                EFUSE_MAX_WORD_UNIT_88E         4
 #define                EFUSE_IC_ID_OFFSET_88E          506
index 4d45e1e82543b8e384df4f2d51fcea91bb322d41..cee6b5e8b070f447c7581b7ba57b99420e246157 100644 (file)
@@ -54,7 +54,7 @@ enum _EFUSE_DEF_TYPE {
 #define EFUSE_MAX_SIZE      256
 /* end of E-Fuse */
 
-#define                EFUSE_MAX_MAP_LEN               256
+#define                EFUSE_MAX_MAP_LEN               512
 #define                EFUSE_MAX_HW_SIZE               512
 #define                EFUSE_MAX_SECTION_BASE  16