Received: by 2002:a05:7412:1703:b0:e2:908c:2ebd with SMTP id dm3csp3975607rdb; Wed, 30 Aug 2023 11:30:06 -0700 (PDT) X-Google-Smtp-Source: AGHT+IHuFWcmGA7MSxj8iux2B2OkrUF7C3fm7JLNYUKKLk/ql/l46uYrpf9FA/WfxocnT6BoG4xJ X-Received: by 2002:adf:f589:0:b0:31a:e06f:2187 with SMTP id f9-20020adff589000000b0031ae06f2187mr2109028wro.56.1693420205884; Wed, 30 Aug 2023 11:30:05 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1693420205; cv=none; d=google.com; s=arc-20160816; b=RjKfKmuIkcUMG9cVDZmpk9UViKJjuTaMxz4f22F0xOWkT+3P4Q/su9+urCFqCMjNU6 Eyd6r6kboG89Jo08xugNF4GrIdqmZ5nHUTjiOpMYgk8kTMjZC/rd1vVPVzTPx6oGXeC2 pR6EiEAAKAJSIt6PoB7ZizgiibyhSiPkR0V420e2SNLIqTc/CNuBDiyfgQ9fkJTLeQLd LTgSPkydADN76f63FBrMPx68IKg8vFPiLbvaMXdby95EaJuExH8pM/CJX4QNq9PtsvtE JCxrNOqEEOBSnuP3nX2eyr11pL+s8Ex3R7J6MjHFl7XoVCN6acLTInIHTEseuFIcADme NX6Q== 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=cxuK7kPgPe2FrszecR1C47CcaHQJoWD59EcmhO+Bru8=; fh=63lSgOWgBEQRgNI2u080wKeCvrcumKrefqvGUbDXIts=; b=fI4casIHZ86Djp1IAVUM+6BZRc4+sm37FbMjFxOCmCZPCkX464ioG9HYNUqnQg6Z7b QRUQmA7gBBRvckdC6X7Nu9yq+1CJpZSp2NN8jpdricNE9k0Rm0wlw+B+eXdvfsKpOd3i lkfQ8iecCDRm8D9jUkK2v8DDUYTfbsu7+p6Th1cnwKeDR8mM9QAsslfrrz9nUaZaPCk/ R4KdIEXfE47Xu7tlugYNGmcLhbrkUdFOl99qR832C36AdV1Zn4vKzY4S/jhcOGRElxER VWJOukWSGQXFUaAFfO3WfyOQ7aANuG7nh5HjbCKj4EYesQciLya/bH6ysVyVwmkcSUNQ MJAQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@yandex.ru header.s=mail header.b=JQ8d4dFj; spf=pass (google.com: domain of linux-wireless-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-wireless-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=yandex.ru Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id v23-20020aa7cd57000000b005234684a7e2si6071122edw.119.2023.08.30.11.30.04; Wed, 30 Aug 2023 11:30:05 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-wireless-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=@yandex.ru header.s=mail header.b=JQ8d4dFj; spf=pass (google.com: domain of linux-wireless-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-wireless-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=yandex.ru Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233549AbjH2JhZ (ORCPT + 3 others); Tue, 29 Aug 2023 05:37:25 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56822 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233820AbjH2JhM (ORCPT ); Tue, 29 Aug 2023 05:37:12 -0400 Received: from forward103a.mail.yandex.net (forward103a.mail.yandex.net [IPv6:2a02:6b8:c0e:500:1:45:d181:d103]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E3CEF9E for ; Tue, 29 Aug 2023 02:37:04 -0700 (PDT) Received: from mail-nwsmtp-smtp-production-main-67.vla.yp-c.yandex.net (mail-nwsmtp-smtp-production-main-67.vla.yp-c.yandex.net [IPv6:2a02:6b8:c15:2c95:0:640:f90:0]) by forward103a.mail.yandex.net (Yandex) with ESMTP id CB87E463C2; Tue, 29 Aug 2023 12:37:00 +0300 (MSK) Received: by mail-nwsmtp-smtp-production-main-67.vla.yp-c.yandex.net (smtp/Yandex) with ESMTPSA id xaMvVGCDgKo0-vhI78Y0m; Tue, 29 Aug 2023 12:37:00 +0300 X-Yandex-Fwd: 1 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yandex.ru; s=mail; t=1693301820; bh=cxuK7kPgPe2FrszecR1C47CcaHQJoWD59EcmhO+Bru8=; h=Message-ID:Date:Cc:Subject:To:From; b=JQ8d4dFjT+zS3yeduEqg+plYllLYSuiyIwl183Hrv1MIgRdyWKSmgp7Lp21GMVhbn CJmxSru2HMbrwnP2+zEncNVYQaAYaeHritJPpKioyJBqZvBTpMdY5y2p3gGrJF2nm3 9i+IXUsxT9QGfdbdkc+nYyaUZ710a/SGE1spQNsA= Authentication-Results: mail-nwsmtp-smtp-production-main-67.vla.yp-c.yandex.net; dkim=pass header.i=@yandex.ru From: Dmitry Antipov To: Jeff Johnson Cc: Kalle Valo , ath10k@lists.infradead.org, linux-wireless@vger.kernel.org, Dmitry Antipov Subject: [PATCH] wifi: ath10k: fix clang-specific fortify warning Date: Tue, 29 Aug 2023 12:36:02 +0300 Message-ID: <20230829093652.234537-1-dmantipov@yandex.ru> X-Mailer: git-send-email 2.41.0 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM, RCVD_IN_DNSWL_BLOCKED,SPF_HELO_NONE,SPF_PASS 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-wireless@vger.kernel.org When compiling with clang 16.0.6 and CONFIG_FORTIFY_SOURCE=y, I've noticed the following (somewhat confusing due to absence of an actual source code location): In file included from drivers/net/wireless/ath/ath10k/debug.c:8: In file included from ./include/linux/module.h:13: In file included from ./include/linux/stat.h:19: In file included from ./include/linux/time.h:60: In file included from ./include/linux/time32.h:13: In file included from ./include/linux/timex.h:67: In file included from ./arch/x86/include/asm/timex.h:5: In file included from ./arch/x86/include/asm/processor.h:23: In file included from ./arch/x86/include/asm/msr.h:11: In file included from ./arch/x86/include/asm/cpumask.h:5: In file included from ./include/linux/cpumask.h:12: In file included from ./include/linux/bitmap.h:11: In file included from ./include/linux/string.h:254: ./include/linux/fortify-string.h:592:4: warning: call to '__read_overflow2_field' declared with 'warning' attribute: detected read beyond size of field (2nd parameter); maybe use struct_group()? [-Wattribute-warning] __read_overflow2_field(q_size_field, size); The compiler actually complains on 'ath10k_debug_get_et_strings()' where fortification logic inteprets call to 'memcpy()' as an attempt to copy the whole 'ath10k_gstrings_stats' array from it's first member and so issues an overread warning. This warning may be silenced by passing an address of the whole array and not the first member to 'memcpy()'. Signed-off-by: Dmitry Antipov --- drivers/net/wireless/ath/ath10k/debug.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/net/wireless/ath/ath10k/debug.c b/drivers/net/wireless/ath/ath10k/debug.c index f9518e1c9903..fe89bc61e531 100644 --- a/drivers/net/wireless/ath/ath10k/debug.c +++ b/drivers/net/wireless/ath/ath10k/debug.c @@ -1140,7 +1140,7 @@ void ath10k_debug_get_et_strings(struct ieee80211_hw *hw, u32 sset, u8 *data) { if (sset == ETH_SS_STATS) - memcpy(data, *ath10k_gstrings_stats, + memcpy(data, ath10k_gstrings_stats, sizeof(ath10k_gstrings_stats)); } -- 2.41.0