wifi: wilc1000: get correct length of string WID from received config packet
authorAjay Singh <ajay.kathat@microchip.com>
Wed, 20 Jul 2022 16:03:04 +0000 (16:03 +0000)
committerKalle Valo <kvalo@kernel.org>
Wed, 27 Jul 2022 12:58:10 +0000 (15:58 +0300)
For string type WID packet, the data length is received as 16-bit value
so use 'get_unaligned_le16' conversion API to extract the correct length.

Signed-off-by: Ajay Singh <ajay.kathat@microchip.com>
Signed-off-by: Kalle Valo <kvalo@kernel.org>
Link: https://lore.kernel.org/r/20220720160302.231516-5-ajay.kathat@microchip.com
drivers/net/wireless/microchip/wilc1000/wlan_cfg.c

index 60eaf62fd16423b27d205c3da031bb84d64bfa0f..131388886acbfa6af83b9a208b18596ab45e7d0b 100644 (file)
@@ -181,9 +181,10 @@ static void wilc_wlan_parse_response_frame(struct wilc *wl, u8 *info, int size)
                                i++;
 
                        if (cfg->s[i].id == wid)
-                               memcpy(cfg->s[i].str, &info[2], info[2] + 2);
+                               memcpy(cfg->s[i].str, &info[2],
+                                      get_unaligned_le16(&info[2]) + 2);
 
-                       len = 2 + info[2];
+                       len = 2 + get_unaligned_le16(&info[2]);
                        break;
 
                default: