Received: by 2002:a05:7412:bc1a:b0:d7:7d3a:4fe2 with SMTP id ki26csp514112rdb; Sat, 19 Aug 2023 10:47:52 -0700 (PDT) X-Google-Smtp-Source: AGHT+IFrxN0B+44Ea3X8TEECbkDb+xta0Fsa3xkz5WKOgTIZTT566poOonO3teGHtf/13jhYS4Wy X-Received: by 2002:a17:902:db0f:b0:1bb:ed01:2d03 with SMTP id m15-20020a170902db0f00b001bbed012d03mr3158532plx.50.1692467271684; Sat, 19 Aug 2023 10:47:51 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1692467271; cv=none; d=google.com; s=arc-20160816; b=vWrz6cosHuQ8NzNfrbrzQjdMdY3iXAwdOcW4dD+MtMlJAQKAshH/kM3r3usIF3AJXW 5drbzvx4jGThJ3BjtSPXNsLeC3oI93l+vWfRYGM14yob6NwVXq7aZNy49dw9Tlhs5RnH e/TF6wZUvL1/OtJiNP3+q3Z+ERXOOu89QrEaqbc5TKrT/lVagWInRsiBOFBNzF+tb4be tlqwwBuP/ueQVxV9c9J+dkm1yTRXI+I7q5vOtuyVSrkE8DpVaUlxvC4tjbcbPU3GC+Oa tDXSVHToHfXGeTW8x2ud66gmAjNNE97b31kVn/Ha4dikMb6zwXLxY35rnLVgXL/rQk6n q6lQ== 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=2ODguKFHh6L7od6TVtWWPZOF8w3+e85uSFZiKNzhCIY=; fh=OFJaPNHGJdLQQeK+q23uA3uwfeqo1PM5wbQu2zUVNYk=; b=Jawc4csCVdj7HM2Q+oE93eDP9AbRj/muO6TPnqzjG5pfgerCriMpjbpyrX/0+7kiTo 757CjXIa3qO1ZybazV7rF8THs+qlf+J4d0dNCcNNDijYj3fj9S2Zr9pkeD+FbACfaUGz L/7GqjjmCgy170lyWsBoQTLf3yQofjam/73Y02jU8OGzngTcjaFdRZTmUGi3x2HrnLYT yWkCQ58taN3oE8jss4mzp2Kma/g0jHRkFpL8fhe+K2XciScZNGsBJJPmIJ6fi8A3Jhe/ YVStZzO5j1mKsPSKp8gBtZtQ2l3SYPmDFmuBJLh1eXTWCH0vdsgQXrVtvZVO0cJVVzYM 8bvg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@quicinc.com header.s=qcppdkim1 header.b=iQFam5dh; spf=pass (google.com: domain of linux-wireless-owner@vger.kernel.org designates 2620:137:e000::1:18 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 lindbergh.monkeyblade.net (lindbergh.monkeyblade.net. [2620:137:e000::1:18]) by mx.google.com with ESMTPS id m10-20020a170902e40a00b001b9e9fa3a38si3494759ple.646.2023.08.19.10.47.51 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 19 Aug 2023 10:47:51 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-wireless-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) client-ip=2620:137:e000::1:18; Authentication-Results: mx.google.com; dkim=pass header.i=@quicinc.com header.s=qcppdkim1 header.b=iQFam5dh; spf=pass (google.com: domain of linux-wireless-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) smtp.mailfrom=linux-wireless-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=quicinc.com Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 5FEAB9962E; Sat, 19 Aug 2023 01:26:13 -0700 (PDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1355590AbjHQWGg (ORCPT + 54 others); Thu, 17 Aug 2023 18:06:36 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53662 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1355637AbjHQWGI (ORCPT ); Thu, 17 Aug 2023 18:06:08 -0400 Received: from mx0a-0031df01.pphosted.com (mx0a-0031df01.pphosted.com [205.220.168.131]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 9161730D6; Thu, 17 Aug 2023 15:05:28 -0700 (PDT) Received: from pps.filterd (m0279866.ppops.net [127.0.0.1]) by mx0a-0031df01.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 37HLkCN6030839; Thu, 17 Aug 2023 22:03:42 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=2ODguKFHh6L7od6TVtWWPZOF8w3+e85uSFZiKNzhCIY=; b=iQFam5dh2gAmst0o6L44x1ogt3JAk3BAuaE4X9ecsueU0Tx3NX+IXEhND91Zd6t6qVpH b8UQqUVaq45K8J7QnOjI6KnYbHU+KAibkAhekBJg6+theUJZgCMkIBLhioEUAB8lufTW iDUfcdEzQWFFgFpLFD59vB0E7LQ9beOdXiw4wBXL21o820pUBYAa5ZQyGo7L61nYfZ/h 8782RwEoRCmf01ipGVcCIt56wJLUz1s0spU/YgRc9SVjOBpe9ikklbjzdnUiW5eU4W7q Qo48u+JjhMCEupxkz+E25gnUvGXneYsY4scmHCVPSm+hgtJF32+aO/F4o9K9tvjpPd0G TA== Received: from nalasppmta01.qualcomm.com (Global_NAT1.qualcomm.com [129.46.96.20]) by mx0a-0031df01.pphosted.com (PPS) with ESMTPS id 3sh3xxb44w-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Thu, 17 Aug 2023 22:03:41 +0000 Received: from nalasex01a.na.qualcomm.com (nalasex01a.na.qualcomm.com [10.47.209.196]) by NALASPPMTA01.qualcomm.com (8.17.1.5/8.17.1.5) with ESMTPS id 37HM3fLF027842 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Thu, 17 Aug 2023 22:03:41 GMT Received: from [10.48.241.213] (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; Thu, 17 Aug 2023 15:03:40 -0700 Message-ID: <23e9a46d-34af-4343-8787-be15e3206e4c@quicinc.com> Date: Thu, 17 Aug 2023 15:03:40 -0700 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH 5/7] wifi: cfg80211: Annotate struct cfg80211_rnr_elems with __counted_by Content-Language: en-US To: Kees Cook , Johannes Berg CC: "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , , , Nathan Chancellor , Nick Desaulniers , Tom Rix , , , References: <20230817211114.never.208-kees@kernel.org> <20230817211531.4193219-5-keescook@chromium.org> From: Jeff Johnson In-Reply-To: <20230817211531.4193219-5-keescook@chromium.org> Content-Type: text/plain; charset="UTF-8"; format=flowed Content-Transfer-Encoding: 7bit X-Originating-IP: [10.49.16.6] X-ClientProxiedBy: nalasex01b.na.qualcomm.com (10.47.209.197) 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: 4u1wL2Nrcw04Qk8edbQGkFXkwoLGHOwy X-Proofpoint-ORIG-GUID: 4u1wL2Nrcw04Qk8edbQGkFXkwoLGHOwy 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-17_18,2023-08-17_02,2023-05-22_02 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 spamscore=0 malwarescore=0 bulkscore=0 mlxlogscore=835 clxscore=1015 priorityscore=1501 impostorscore=0 adultscore=0 phishscore=0 suspectscore=0 mlxscore=0 lowpriorityscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2306200000 definitions=main-2308170196 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_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 On 8/17/2023 2:15 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 cfg80211_rnr_elems. > Additionally, since the element count member must be set before accessing > the annotated flexible array member, move its initialization earlier. > > [1] https://github.com/kees/kernel-tools/blob/trunk/coccinelle/examples/counted_by.cocci > > Cc: Johannes Berg > Cc: "David S. Miller" > Cc: Eric Dumazet > Cc: Jakub Kicinski > Cc: Paolo Abeni > Cc: linux-wireless@vger.kernel.org > Cc: netdev@vger.kernel.org > Signed-off-by: Kees Cook Reviewed-by: Jeff Johnson