Received: by 2002:a05:7412:31a9:b0:e2:908c:2ebd with SMTP id et41csp4869891rdb; Fri, 15 Sep 2023 15:12:33 -0700 (PDT) X-Google-Smtp-Source: AGHT+IFRJyTHRvDA+d//dfJIgOV3bDXgSTRbymwvAVyW5PQIBx4GR6mQr4tbr0XHnManqAylep1B X-Received: by 2002:a05:6a20:8e05:b0:153:6413:1089 with SMTP id y5-20020a056a208e0500b0015364131089mr4045202pzj.46.1694815952765; Fri, 15 Sep 2023 15:12:32 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1694815952; cv=none; d=google.com; s=arc-20160816; b=CPstxMZ24uPNPqU4Yz6VJVQJ6ae0oRl5QDlAviPPMF/agwRsD2dPTXMLgtBC1YZ7TU m4Zj9eygQAkJ3Q3Hk8+1BL8ImVu6R0g109MGA9f3GpI/d5t2dBktTd6EbULcfk8GgY0T 67miSPr6+aJpdFG8kvSxy2hx21p2QYleObOfyHmJ99rdfZ+OL27SxzYMD6+t6EYzZE4i qKKwaP1e7SZPVQLmsCU7f3tOJcaQHgmSQrg5jDszlzsQCgYpWnKdKVm7h+vE/IRlIAIY wEXI9FUOz4ErDuwixQgcjm3p5fdMFso2POZKKaRni1GwPXXt1LFGsjxexWhNQASicxFY JNTQ== 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=cUJUg7Dvcc0uo1bVuElb2MqCHjygzkZYsy45Az74LTg=; fh=KuQoXADu2z9+aFM6jZHNh6igYCuXaa5XTfacnUIeA50=; b=LXORX8TN6hsmKi2YGnHvtjsSDaTRf/xwCe+j7k3G+UkxKK1DNO/SEsYd+01cTCrCJI dj9k6OliZrm5TKFqEzz4U5tBpAPXM+7h1Uum+CEEVMgCYF+4LULsOBqdqhvGsdt457XG Hxtv57dUPbgRaLvcKmT5pRZgCE+G1KTvyVI3MHvFXGbVIywBBP1tJ4Py8R2DyIqv8ZGo x/nx+8o/mcfhMF8fgMaF8YO4lGUQuW1vIe9V6WhT2gQCR5bZXaFtye8X6pok5m7m+fnv LNh+B1aeDq6hzk+VCHlxMkB721K7i2hwZtRSaUnyTV1DJD0//z4nWQMFRjobx9v/Q2ty /cEQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@quicinc.com header.s=qcppdkim1 header.b=nLIiJ8X6; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:1 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=quicinc.com Return-Path: Received: from morse.vger.email (morse.vger.email. [2620:137:e000::3:1]) by mx.google.com with ESMTPS id j191-20020a6380c8000000b0056aca1f1d5csi3781304pgd.777.2023.09.15.15.12.32 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 15 Sep 2023 15:12:32 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:1 as permitted sender) client-ip=2620:137:e000::3:1; Authentication-Results: mx.google.com; dkim=pass header.i=@quicinc.com header.s=qcppdkim1 header.b=nLIiJ8X6; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:1 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=quicinc.com Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by morse.vger.email (Postfix) with ESMTP id 790CB809E894; Fri, 15 Sep 2023 13:40:24 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at morse.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235447AbjIOUjo (ORCPT + 99 others); Fri, 15 Sep 2023 16:39:44 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52290 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S237540AbjIOUjj (ORCPT ); Fri, 15 Sep 2023 16:39:39 -0400 Received: from mx0b-0031df01.pphosted.com (mx0b-0031df01.pphosted.com [205.220.180.131]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id AB346170E; Fri, 15 Sep 2023 13:39:33 -0700 (PDT) Received: from pps.filterd (m0279873.ppops.net [127.0.0.1]) by mx0a-0031df01.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 38FEJ1t3024585; Fri, 15 Sep 2023 20:38:55 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=cUJUg7Dvcc0uo1bVuElb2MqCHjygzkZYsy45Az74LTg=; b=nLIiJ8X6RpRe37cPCbSzIg5DQPz7hj0Bpc1LJMIWsoVN5gsy3Ke9wSBCZS5lQ40xJCWn pzz+TeQsxs0EldY6AFygKuupPH63SZbBgL+tFpRy7pfCsXvSvqi0RhCK6imHjhU+voG1 RXA/s8l6Qtt0QpwOlV4MAUIltwc/wILoQeh8S1c0u+fR0lhjtSVVZNnClKlBFJ62wXtP AqHg2Pax+GXqfzqIIlEefAxKotbIMaXt5rGrDytJNPmo82FceLjMVhntUtqghK+zAUy3 yXAQtUH1gyBl3clZn5Hy7Cc4CNjBtQnAo+CeJimrGwUYOhkfeyaOV3boFw4rY00x+zfy Rw== Received: from nalasppmta05.qualcomm.com (Global_NAT1.qualcomm.com [129.46.96.20]) by mx0a-0031df01.pphosted.com (PPS) with ESMTPS id 3t4g3na43e-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Fri, 15 Sep 2023 20:38:55 +0000 Received: from nalasex01a.na.qualcomm.com (nalasex01a.na.qualcomm.com [10.47.209.196]) by NALASPPMTA05.qualcomm.com (8.17.1.5/8.17.1.5) with ESMTPS id 38FKcs6n015194 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Fri, 15 Sep 2023 20:38:54 GMT Received: from [10.111.183.186] (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; Fri, 15 Sep 2023 13:38:53 -0700 Message-ID: Date: Fri, 15 Sep 2023 13:38:53 -0700 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH] wifi: ath10k: Annotate struct ath10k_ce_ring with __counted_by Content-Language: en-US To: Kees Cook , Kalle Valo CC: , , Nathan Chancellor , Nick Desaulniers , Tom Rix , , , References: <20230915200636.never.762-kees@kernel.org> From: Jeff Johnson In-Reply-To: <20230915200636.never.762-kees@kernel.org> 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: _uNb7NU9OXe3-rG86dkEMYBsSkzJYTJh X-Proofpoint-ORIG-GUID: _uNb7NU9OXe3-rG86dkEMYBsSkzJYTJh X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.267,Aquarius:18.0.980,Hydra:6.0.601,FMLib:17.11.176.26 definitions=2023-09-15_17,2023-09-15_01,2023-05-22_02 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 suspectscore=0 priorityscore=1501 malwarescore=0 phishscore=0 spamscore=0 impostorscore=0 lowpriorityscore=0 bulkscore=0 clxscore=1011 mlxscore=0 mlxlogscore=912 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2308100000 definitions=main-2309150183 X-Spam-Status: No, score=-0.9 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on morse.vger.email Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (morse.vger.email [0.0.0.0]); Fri, 15 Sep 2023 13:40:24 -0700 (PDT) On 9/15/2023 1:06 PM, Kees Cook wrote: > Prepare for the coming implementation by GCC and Clang of the __counted_by > attribute. Flexible array members annotated with __counted_by can have > their accesses bounds-checked at run-time checking via CONFIG_UBSAN_BOUNDS > (for array indexing) and CONFIG_FORTIFY_SOURCE (for strcpy/memcpy-family > functions). > > As found with Coccinelle[1], add __counted_by for struct ath10k_ce_ring. > > [1] https://github.com/kees/kernel-tools/blob/trunk/coccinelle/examples/counted_by.cocci > > Cc: Kalle Valo > Cc: Jeff Johnson > Cc: ath10k@lists.infradead.org > Cc: linux-wireless@vger.kernel.org > Signed-off-by: Kees Cook Acked-by: Jeff Johnson > --- > drivers/net/wireless/ath/ath10k/ce.h | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/drivers/net/wireless/ath/ath10k/ce.h b/drivers/net/wireless/ath/ath10k/ce.h > index 666ce384a1d8..27367bd64e95 100644 > --- a/drivers/net/wireless/ath/ath10k/ce.h > +++ b/drivers/net/wireless/ath/ath10k/ce.h > @@ -110,7 +110,7 @@ struct ath10k_ce_ring { > struct ce_desc_64 *shadow_base; > > /* keep last */ > - void *per_transfer_context[]; > + void *per_transfer_context[] __counted_by(nentries); > }; > > struct ath10k_ce_pipe {