8000 cc3200: Fix various array-based compiler warnings. · micropython/micropython@4cf9928 · GitHub
[go: up one dir, main page]

Skip to content

Commit 4cf9928

Browse files
jimmodpgeorge
authored andcommitted
cc3200: Fix various array-based compiler warnings.
1. Add -Wno-array-bounds to avoid false positive on gcc 12.1; see related issue #8685. 2. Remove always-true not-NULL-check (Msg.Rsp.Args.Common.Bssid is an array not a pointer). 3. Fix pointer-to-freed-stack in wlan_set_security. Signed-off-by: Jim Mussared <jim.mussared@gmail.com>
1 parent a053827 commit 4cf9928

File tree

3 files changed

+5
-5
lines changed

3 files changed

+5
-5
lines changed

drivers/cc3100/src/wlan.c

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -536,10 +536,7 @@ _i16 sl_WlanProfileGet(const _i16 Index,_i8* pName, _i16 *pNameLen, _u8 *pMacAd
536536
*pNameLen = Msg.Rsp.Args.Common.SsidLen;
537537
*pPriority = Msg.Rsp.Args.Common.Priority;
538538

539-
if (NULL != Msg.Rsp.Args.Common.Bssid)
540-
{
541-
sl_Memcpy(pMacAddr, Msg.Rsp.Args.Common.Bssid, sizeof(Msg.Rsp.Args.Common.Bssid));
542-
}
539+
sl_Memcpy(pMacAddr, Msg.Rsp.Args.Common.Bssid, sizeof(Msg.Rsp.Args.Common.Bssid));
543540

544541
sl_Memcpy(pName, EAP_PROFILE_SSID_STRING(&Msg), *pNameLen);
545542

ports/cc3200/Makefile

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,9 @@ CFLAGS += -g -ffunction-sections -fdata-sections -fno-common -fsigned-char -mno-
2525
CFLAGS += -Iboards/$(BOARD)
2626
CFLAGS += $(CFLAGS_MOD)
2727

28+
# Workaround gcc 12.1 bug.
29+
CFLAGS += -Wno-array-bounds
30+
2831
LDFLAGS = -Wl,-nostdlib -Wl,--gc-sections -Wl,-Map=$@.map
2932

3033
FLASH_SIZE_WIPY = 2M

ports/cc3200/mods/modwlan.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -641,8 +641,8 @@ STATIC void wlan_set_security (uint8_t auth, const char *key, uint8_t len) {
641641
if (key != NULL) {
642642
memcpy(&wlan_obj.key, key, len);
643643
wlan_obj.key[len] = '\0';
644+
_u8 wep_key[32];
644645
if (auth == SL_SEC_TYPE_WEP) {
645-
_u8 wep_key[32];
646646
wlan_wep_key_unhexlify(key, (char *)&wep_key);
647647
key = (const char *)&wep_key;
648648
len /= 2;

0 commit comments

Comments
 (0)
0