Received: by 2002:a05:7412:1703:b0:e2:908c:2ebd with SMTP id dm3csp3978325rdb; Wed, 30 Aug 2023 11:34:25 -0700 (PDT) X-Google-Smtp-Source: AGHT+IFbdT3714biZjy379uP5bb5nNlKZtd4cER1WyO7fTbcERgUJxZgjlAbKU2ucSPLGFdGo0I+ X-Received: by 2002:a05:6358:52d4:b0:139:cdfa:52d6 with SMTP id z20-20020a05635852d400b00139cdfa52d6mr3829517rwz.11.1693420464778; Wed, 30 Aug 2023 11:34:24 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1693420464; cv=none; d=google.com; s=arc-20160816; b=BklzYdYXACRt/zcBY1p5GnOgNNWQr3uDEJo0Zff8JsHEP4zwLJiPeL8RDVcvdFurwV ZjUgZ7Bshb67dx3lvmQvFnQAzX9YMgYktMVSGoQr2Cb2MOXnrq6c8bpIbFh9dczG/zYs 44/004wIUuPmVNN5Ux+sQG34kJZye4Id/Oclx3ihOVUxq3iuIWOW0GY5f8305EzMdI42 qkOSojRiSSJTt9iKz+W0ebQ/FvOe1LHO//4Sy61RPO/ju7udhKFKgB7vu54oi+0ihzgI +IY4rSyN/sJXmgbQPJJ8waElulNkZJeJm+pWdkD/Hb5GHC0smLO6KlntlzzKDtz79VHS RdhA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:in-reply-to:from :references:cc:to:content-language:subject:user-agent:mime-version :date:message-id:dkim-signature; bh=gaZKkYkou1U3yCZEvJPkLuWSrXOx2/F9Hb90sYTtJx0=; fh=vAlnYhdVcVvemTLQzrXV/WxxK//15UfWQtdkrRLnjQE=; b=Mn8TlIzn4ZL55TSzArSrOPMkS4f/aFoc0ZiW4sESsQ00c7pyG3lKTGV5eeQvUEQZwI D7QZ/w/EPFwJyNLYds04U3sNy61v0Rzh7FWXqOrCdOpRpShlOqbdHt4VAXbjYD1jFOyR aTQDtGuo0JIdpcv3JJcjBYW/DeBCzybQKckU8TgPElI28UVusx8JTK4NF/q+z7dIxULy +elNp4EqjsrPgeH4Npz84QbuxguWiDXRxsMFx4x7SorLzdjDt8RYQjWfZweBUDR5Am7/ nfrnoT0fg8FEsgKHbL284jx6BU1aPxMSMqys6HSEM+K/ppcNnXGlJEeswUP+qP8zxff9 e/3g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@quicinc.com header.s=qcppdkim1 header.b=pk4ztNlX; 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=quicinc.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id w24-20020a637b18000000b0057047d68837si1564985pgc.869.2023.08.30.11.34.24; Wed, 30 Aug 2023 11:34:24 -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=@quicinc.com header.s=qcppdkim1 header.b=pk4ztNlX; 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=quicinc.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232819AbjH2Nnx (ORCPT + 3 others); Tue, 29 Aug 2023 09:43:53 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52500 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236588AbjH2Nnr (ORCPT ); Tue, 29 Aug 2023 09:43:47 -0400 Received: from mx0a-0031df01.pphosted.com (mx0a-0031df01.pphosted.com [205.220.168.131]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 6B605CD5 for ; Tue, 29 Aug 2023 06:43:19 -0700 (PDT) Received: from pps.filterd (m0279862.ppops.net [127.0.0.1]) by mx0a-0031df01.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 37T5vLEo031793; Tue, 29 Aug 2023 13:41:59 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=quicinc.com; h=message-id : date : mime-version : subject : to : cc : references : from : in-reply-to : content-type : content-transfer-encoding; s=qcppdkim1; bh=gaZKkYkou1U3yCZEvJPkLuWSrXOx2/F9Hb90sYTtJx0=; b=pk4ztNlXlqkwoA+MLtQgSsPgNx5xt7OhVdPdCi1esMzS3XkrpH/QkCtkZ4XwgA7pgGjG +dUpWuUPuHSDlD1qQmOXEuoKUE6FgwTwC8Fll79TfR4CkIr6DKMuUWaL5vIjc83expuG l6novHcegPLE6YRQLT4KiZ3xxHisL8DaBm3U56/Tp9Hy+YNrjGCbJ6K/I79oAWZyDFmZ PMl6ZXCMpbtx6LJMu210nkPsxQNT+hZUC9iDiYuKd+9ZjUKQVPMyksK/KMj5tuKicXbi dL1BJY7p/nOZnsB3w0fCITC0DiZ7k3bPOR1qTYzkGL9kxqDZ95k/vp74JkPP54oZeekk iQ== Received: from nalasppmta03.qualcomm.com (Global_NAT1.qualcomm.com [129.46.96.20]) by mx0a-0031df01.pphosted.com (PPS) with ESMTPS id 3srvr82uuv-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Tue, 29 Aug 2023 13:41:59 +0000 Received: from nalasex01a.na.qualcomm.com (nalasex01a.na.qualcomm.com [10.47.209.196]) by NALASPPMTA03.qualcomm.com (8.17.1.5/8.17.1.5) with ESMTPS id 37TDfwJt029970 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Tue, 29 Aug 2023 13:41:58 GMT Received: from [10.48.245.159] (10.49.16.6) by nalasex01a.na.qualcomm.com (10.47.209.196) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.1118.36; Tue, 29 Aug 2023 06:41:58 -0700 Message-ID: <494e0309-314b-4982-9575-61f8e690c237@quicinc.com> Date: Tue, 29 Aug 2023 06:41:57 -0700 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH] wifi: ath10k: fix clang-specific fortify warning Content-Language: en-US To: Dmitry Antipov CC: Kalle Valo , , References: <20230829093652.234537-1-dmantipov@yandex.ru> From: Jeff Johnson In-Reply-To: <20230829093652.234537-1-dmantipov@yandex.ru> Content-Type: text/plain; charset="UTF-8"; format=flowed Content-Transfer-Encoding: 7bit X-Originating-IP: [10.49.16.6] X-ClientProxiedBy: nalasex01a.na.qualcomm.com (10.47.209.196) To nalasex01a.na.qualcomm.com (10.47.209.196) X-QCInternal: smtphost X-Proofpoint-Virus-Version: vendor=nai engine=6200 definitions=5800 signatures=585085 X-Proofpoint-GUID: 7wYguPLUP895CchGz4upRJ06u--4kGNN X-Proofpoint-ORIG-GUID: 7wYguPLUP895CchGz4upRJ06u--4kGNN X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.267,Aquarius:18.0.957,Hydra:6.0.601,FMLib:17.11.176.26 definitions=2023-08-29_10,2023-08-29_01,2023-05-22_02 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 adultscore=0 priorityscore=1501 mlxlogscore=521 spamscore=0 clxscore=1015 impostorscore=0 malwarescore=0 lowpriorityscore=0 suspectscore=0 mlxscore=0 phishscore=0 bulkscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2308100000 definitions=main-2308290118 X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_NONE, 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 On 8/29/2023 2:36 AM, Dmitry Antipov wrote: > 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 Acked-by: Jeff Johnson > --- > 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)); > } >