From patchwork Mon Jul 3 12:37:29 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Arnd Bergmann X-Patchwork-Id: 115345 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:9f45:0:b0:3ea:f831:8777 with SMTP id v5csp505405vqx; Mon, 3 Jul 2023 06:03:28 -0700 (PDT) X-Google-Smtp-Source: APBJJlFbl+Gkv7WU6ibBt+eaByQhjlA6MMUTU34iPB979Rqr7eS2BT+FDcxCMPVYpOUCRTBKDd9/ X-Received: by 2002:a17:90a:4e82:b0:263:484c:f173 with SMTP id o2-20020a17090a4e8200b00263484cf173mr12091625pjh.2.1688389407616; Mon, 03 Jul 2023 06:03:27 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1688389407; cv=none; d=google.com; s=arc-20160816; b=wLx61uhPzacZAYotvFK7dbpDKS9/S792Iu2B6qehxDOabY+1fEYqY1azIgSn8y02+Z fg40MHHNTYZdPSJIYOaV+XsunAbYHGTiNU2OuuqHfDxzr9RfXrCdvrhBYwAbQmGrgcMr z+MfpUbaE5sC0Tj0UKXPFeXISrJw4+zIZbPdCVu26CLq8KMIp6dNDicP5TLoDJQsTFEy 143/pT5Q9w4xDAgGkUh2PKN3rFPUhGPaJqmZZmV0wM58FUPeJ/Gt1kn5T7dreVATJqjr t+Gq3D2SEspmm0K4yREzhla+vqUjYlG98o5sZeN+4/IR/bBP5ZTTHBRVJjlK6seJk8Uw uDUQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from:dkim-signature; bh=GENpZ2oKa/bY4ugRZxOUCKB7SiRL0KgSID5HIQtqYYI=; fh=/DHa80RkY5t06kEEObry+DBM8hKsrLDPphDbZ2eF16U=; b=0g248hbmUXjeiN2TbsW7eJI43nagcg2BpWCH8ae+LE+aevhZ6TbHxG6ln4Y/3pTVfN bQec4vl/b7mGrqNS5ara/iHJPbktwOK6WxgfiZ6p4+jwNqZijMZ5Rc0dIwEmtFfRpV4G Tw/k8S8arjMKwW0pzEQrMbeIWSW0VffH9Czw1tMr9cqUntakr3zjAB0kKNoF9dOe/rMa QhyvZQ7ohFZ9SyKC4ivCX7gGIbF8uMhq4HXUW3D61cMX+P1XGGl7qe2RwHtNSMob3hnl S0s9P0NYVgpQ6hlgN3RqsEpiwF+rLeD9/y1KM+aOUiot+A5Z1CH66wTjykRx8ZHqnYM+ I24w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=e4Gki4SK; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id a71-20020a63904a000000b00557899ed8b4si18618361pge.156.2023.07.03.06.03.07; Mon, 03 Jul 2023 06:03:27 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=e4Gki4SK; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229454AbjGCMiG (ORCPT + 99 others); Mon, 3 Jul 2023 08:38:06 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:51748 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230365AbjGCMhx (ORCPT ); Mon, 3 Jul 2023 08:37:53 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 83876E5B; Mon, 3 Jul 2023 05:37:45 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 12BCE60F05; Mon, 3 Jul 2023 12:37:45 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 26FE7C433C7; Mon, 3 Jul 2023 12:37:40 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1688387864; bh=xE8FXAxkc+98q1QU4W/ZwNlsV+CRuDU4Ozer4CAamV4=; h=From:To:Cc:Subject:Date:From; b=e4Gki4SKoeFIHNhBDdp43WTmmhs67Z90hx3Gbp5OxiIM+VxYZ2YNzjuTmulL+uTnS hugfDCTyhZ3S0URDNTeT0ac9FNZ3aEAO1ib4xyhpZYGN8QzuQXTGzLXr+fkDPqmMjm FtY/C//GWwKdwOL4A8u1UTmpo1NazAca9iigX940vapsLqrCKM+3pr8mMfNMERmMLw Vuoax/l/WCVPLtogIR0OTtdSQkWTDWTKDPeKNPcOuMP6ZYi1WOP1DsqXGxLxMe1bZk AqfgoG5yyr15uGKRWXcozsSpteqhqxpGGqqTjUclquoq9teD5dO9BtMnw3RMmkcAQY rX298AQBd+jRA== From: Arnd Bergmann To: Kalle Valo , Jeff Johnson , Balamurugan Selvarajan , P Praneesh , Baochen Qiang , Karthikeyan Periyasamy Cc: Arnd Bergmann , Ramya Gnanasekar , Wen Gong , Karthik M , Aditya Kumar Singh , Aishwarya R , Carl Huang , ath12k@lists.infradead.org, linux-wireless@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH] ath12k: fix memcpy array overflow in ath12k_peer_assoc_h_he Date: Mon, 3 Jul 2023 14:37:29 +0200 Message-Id: <20230703123737.3420464-1-arnd@kernel.org> X-Mailer: git-send-email 2.39.2 MIME-Version: 1.0 X-Spam-Status: No, score=-4.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_MED, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1770404611607180547?= X-GMAIL-MSGID: =?utf-8?q?1770404611607180547?= From: Arnd Bergmann Two memory copies in this function copy from a short array into a longer one, using the wrong size, which leads to an out-of-bounds access: include/linux/fortify-string.h:592:4: error: call to '__read_overflow2_field' declared with 'warning' attribute: detected read beyond size of field (2nd parameter); maybe use struct_group()? [-Werror,-Wattribute-warning] __read_overflow2_field(q_size_field, size); ^ include/linux/fortify-string.h:592:4: error: call to '__read_overflow2_field' declared with 'warning' attribute: detected read beyond size of field (2nd parameter); maybe use struct_group()? [-Werror,-Wattribute-warning] 2 errors generated. Fixes: d889913205cf7 ("wifi: ath12k: driver for Qualcomm Wi-Fi 7 devices") Signed-off-by: Arnd Bergmann --- drivers/net/wireless/ath/ath12k/mac.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/net/wireless/ath/ath12k/mac.c b/drivers/net/wireless/ath/ath12k/mac.c index f5ebebe806e0d..b8a8d33cc4187 100644 --- a/drivers/net/wireless/ath/ath12k/mac.c +++ b/drivers/net/wireless/ath/ath12k/mac.c @@ -1637,9 +1637,9 @@ static void ath12k_peer_assoc_h_he(struct ath12k *ar, arg->peer_nss = min(sta->deflink.rx_nss, max_nss); memcpy(&arg->peer_he_cap_macinfo, he_cap->he_cap_elem.mac_cap_info, - sizeof(arg->peer_he_cap_macinfo)); + sizeof(he_cap->he_cap_elem.mac_cap_info)); memcpy(&arg->peer_he_cap_phyinfo, he_cap->he_cap_elem.phy_cap_info, - sizeof(arg->peer_he_cap_phyinfo)); + sizeof(he_cap->he_cap_elem.phy_cap_info)); arg->peer_he_ops = vif->bss_conf.he_oper.params; /* the top most byte is used to indicate BSS color info */