From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 7CF6110E0; Fri, 6 Dec 2024 14:58:42 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1733497123; cv=none; b=kwrgRKYNaJRZojpOMly+FKfo3Dyjp1CYlcS+awkEuQjL9RvI24+oVWoTvpRELGWE8JO3ZneOU6Qr38UqW1NzKfuSduvV0irnHocN0hc1Y/b5k88MD6D1nv9/DkfjiTKGbDKtglzjTsmdpBuLtFJfDTnM/7eO/3e8BSKAHiI7J28= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1733497123; c=relaxed/simple; bh=p2RXcBzVk4XhomuZqAtek26BPVs0+1wz3L4XJYBIBFQ=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=jE0Y4M6HekJ1JHcnORGcDhd/XkDGdO/3S4wlVSXmHqYC7RaH3TxAhyEENUY5VWkQxGJsOeCEysGtL0m4AinaVd19YvWjE7D9/6WOgexsniYMXCeZTjpH5E32g5qgUuoaz3L6CiqLVhIT8szDhZbamhYHQYHh2f8oUCCXfFnWZWQ= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=ZcpTcpMY; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b="ZcpTcpMY" Received: by smtp.kernel.org (Postfix) with ESMTPSA id AE650C4CED1; Fri, 6 Dec 2024 14:58:41 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1733497122; bh=p2RXcBzVk4XhomuZqAtek26BPVs0+1wz3L4XJYBIBFQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=ZcpTcpMYqIqFhAg8QyBZ5qFbfohhKrc2rZjmGov7uKlRpSvrZcsVomDlwYoozOVqH /zul0cabsNm4MQPGBE/Cq05lMPNy0VgULkqL5OouuCex4jP5DWSqrFZvGeV7AitrtH rlcsy4oaR8nZEiTEEwIciq4X7FS/U9H4vzOgIQjE= From: Greg Kroah-Hartman To: stable@vger.kernel.org Cc: Greg Kroah-Hartman , patches@lists.linux.dev, Alper Nebi Yasak , Brian Norris , Kalle Valo , Sasha Levin Subject: [PATCH 6.6 201/676] wifi: mwifiex: Fix memcpy() field-spanning write warning in mwifiex_config_scan() Date: Fri, 6 Dec 2024 15:30:20 +0100 Message-ID: <20241206143701.196852289@linuxfoundation.org> X-Mailer: git-send-email 2.47.1 In-Reply-To: <20241206143653.344873888@linuxfoundation.org> References: <20241206143653.344873888@linuxfoundation.org> User-Agent: quilt/0.67 X-stable: review X-Patchwork-Hint: ignore Precedence: bulk X-Mailing-List: stable@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 6.6-stable review patch. If anyone has any objections, please let me know. ------------------ From: Alper Nebi Yasak [ Upstream commit d241a139c2e9f8a479f25c75ebd5391e6a448500 ] Replace one-element array with a flexible-array member in `struct mwifiex_ie_types_wildcard_ssid_params` to fix the following warning on a MT8173 Chromebook (mt8173-elm-hana): [ 356.775250] ------------[ cut here ]------------ [ 356.784543] memcpy: detected field-spanning write (size 6) of single field "wildcard_ssid_tlv->ssid" at drivers/net/wireless/marvell/mwifiex/scan.c:904 (size 1) [ 356.813403] WARNING: CPU: 3 PID: 742 at drivers/net/wireless/marvell/mwifiex/scan.c:904 mwifiex_scan_networks+0x4fc/0xf28 [mwifiex] The "(size 6)" above is exactly the length of the SSID of the network this device was connected to. The source of the warning looks like: ssid_len = user_scan_in->ssid_list[i].ssid_len; [...] memcpy(wildcard_ssid_tlv->ssid, user_scan_in->ssid_list[i].ssid, ssid_len); There is a #define WILDCARD_SSID_TLV_MAX_SIZE that uses sizeof() on this struct, but it already didn't account for the size of the one-element array, so it doesn't need to be changed. Fixes: 5e6e3a92b9a4 ("wireless: mwifiex: initial commit for Marvell mwifiex driver") Signed-off-by: Alper Nebi Yasak Acked-by: Brian Norris Signed-off-by: Kalle Valo Link: https://patch.msgid.link/20241007222301.24154-1-alpernebiyasak@gmail.com Signed-off-by: Sasha Levin --- drivers/net/wireless/marvell/mwifiex/fw.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/net/wireless/marvell/mwifiex/fw.h b/drivers/net/wireless/marvell/mwifiex/fw.h index a3be37526697b..7b06a6d57ffb0 100644 --- a/drivers/net/wireless/marvell/mwifiex/fw.h +++ b/drivers/net/wireless/marvell/mwifiex/fw.h @@ -842,7 +842,7 @@ struct mwifiex_ietypes_chanstats { struct mwifiex_ie_types_wildcard_ssid_params { struct mwifiex_ie_types_header header; u8 max_ssid_length; - u8 ssid[1]; + u8 ssid[]; } __packed; #define TSF_DATA_SIZE 8 -- 2.43.0