From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 8BC60C64EDA for ; Thu, 17 Aug 2023 22:31:23 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1355758AbjHQWaw (ORCPT ); Thu, 17 Aug 2023 18:30:52 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48150 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1355733AbjHQWaT (ORCPT ); Thu, 17 Aug 2023 18:30:19 -0400 Received: from mx0a-0031df01.pphosted.com (mx0a-0031df01.pphosted.com [205.220.168.131]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 4FCA730DA; Thu, 17 Aug 2023 15:30:17 -0700 (PDT) Received: from pps.filterd (m0279867.ppops.net [127.0.0.1]) by mx0a-0031df01.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 37HLp19o007187; Thu, 17 Aug 2023 22:03:45 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=5p4UN0NasWWtwUDvgEghzv9AhE9oFggg3a5QgUnVUw4=; b=JJcqUyFZccxAAQKcLKLwXo7BVu36AZGkfkFul+wMlP/fqdY4QWHQJK2IvYO79FfjEjq/ XZ4gHfCncN5r107+ksSIQ/6H5e6qdj5aiTuOu879I4gbC2P6wPeO1tktc+SFuNGA+Ayv VNO3Hfmmmw8lDxfVR/NqQoQtSHbvgzcrTupbKBS4btcaQmyyulcBdSsPlu49myDE/cJ0 b0CiMoIE1qfUZz1EiNcBiUkiLOtbKR4BfjSX1sFCWo0eCkI0YzyWRIKkx/Kd9BXyAcq1 QOw32P8GOzE2Y2eY0l/ZAE6ycYSCiECM1GZwPwh57Oohsq+bjK3R4R0m1UGvH7/3M48A +w== Received: from nalasppmta05.qualcomm.com (Global_NAT1.qualcomm.com [129.46.96.20]) by mx0a-0031df01.pphosted.com (PPS) with ESMTPS id 3shbc0tber-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Thu, 17 Aug 2023 22:03:45 +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 37HM3iEs011275 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Thu, 17 Aug 2023 22:03:44 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:43 -0700 Message-ID: <057ee7f7-ce60-45e9-9602-8046f78d8fb9@quicinc.com> Date: Thu, 17 Aug 2023 15:03:43 -0700 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH 6/7] wifi: cfg80211: Annotate struct cfg80211_scan_request 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-6-keescook@chromium.org> From: Jeff Johnson In-Reply-To: <20230817211531.4193219-6-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-ORIG-GUID: LL15tA1U3um3hZWpW-MUj35JQzsq20Bp X-Proofpoint-GUID: LL15tA1U3um3hZWpW-MUj35JQzsq20Bp 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 suspectscore=0 bulkscore=0 mlxlogscore=902 clxscore=1015 priorityscore=1501 impostorscore=0 adultscore=0 spamscore=0 lowpriorityscore=0 phishscore=0 mlxscore=0 malwarescore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2306200000 definitions=main-2308170196 Precedence: bulk List-ID: X-Mailing-List: linux-kernel@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_scan_request. > 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