Received: by 2002:a05:7412:d8a:b0:e2:908c:2ebd with SMTP id b10csp678292rdg; Wed, 11 Oct 2023 02:20:42 -0700 (PDT) X-Google-Smtp-Source: AGHT+IFL9gVzMKXg76EnwcyRfGiwSWz3CXOpuHJ1CBQLFZTfNXyvsOC8A0JUpu9aeAmn75EdCJuC X-Received: by 2002:a05:6e02:1bea:b0:352:9f54:c586 with SMTP id y10-20020a056e021bea00b003529f54c586mr28481261ilv.10.1697016041981; Wed, 11 Oct 2023 02:20:41 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1697016041; cv=none; d=google.com; s=arc-20160816; b=kfDz5ftRf8kjegW/CxxJaRatlZMDgXN4ASJqtHu9SN4GeRtb3T31BPQLXfW9hBc69l RlHF9mpvN8mRbw0iygLh4E4oj9SGicWGGKAzn/g6PyDZwGZXXOLZ8Ll/ZExkXjWdm/2v e307rcre6tZKFp/PJfONLMjnBPKhxi8U8cxCYIdLn6XRgMT12i71hL0lgL07UH0WDK/G C+Ml+E9C3aonLbWSRpdJPIVSI7P4g9bhvv86MxgpNC9/Bhr+2llKKC0OHWEq8tFVsb/r U8EVeeyWgld+s8tbdwg8fy+ZmPGmCqf+NO7qes6WZHX3ecHXNKqKPJx82XloB3d5e28d EdSw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:date:message-id:user-agent:cc:to:references :in-reply-to:from:subject:content-transfer-encoding:mime-version :dkim-signature; bh=1P7nvtA514Ek22p2l9oQjGc0bCpTa1Dz4EaBzfcTSvU=; fh=T+tkQaph9vVep5A2o1Rd2R33bARJOjqW9wvX+o5btGs=; b=jawqz0i0TB7xgWO6PyceR0Yr8BjW+zidP/UgdiJm/j0rkyE1xiIE7IaIh9t/eve/dX 4bs1axd9L2qk4NvqGHE2SrdjY4qFu2wb3qDYA25N56us/+iPt4KwD5qswNz8EJ99TBaA ED7bf1D/LMPy120VfTY/3w/215wTgh0La+j8xj1JnP2Mu0h0hX1Wiep7jKPO5huwFCME tVMyMOxYNZapkOy0PM9aLq+t0DooDi5HezpWpJgntZNcZhFPFtacwzCjPNF9VovSTZCS sYtIsTAqTjL/LxLgMoxwh1Un6Wkt+KVdU0M4lbfqyz05SDq6PLpkEw39q2XJA/bFypqJ lIuw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=ExCST8SG; spf=pass (google.com: domain of linux-wireless-owner@vger.kernel.org designates 23.128.96.32 as permitted sender) smtp.mailfrom=linux-wireless-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from agentk.vger.email (agentk.vger.email. [23.128.96.32]) by mx.google.com with ESMTPS id b128-20020a633486000000b00565e6a5b065si13769712pga.107.2023.10.11.02.20.41 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 11 Oct 2023 02:20:41 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-wireless-owner@vger.kernel.org designates 23.128.96.32 as permitted sender) client-ip=23.128.96.32; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=ExCST8SG; spf=pass (google.com: domain of linux-wireless-owner@vger.kernel.org designates 23.128.96.32 as permitted sender) smtp.mailfrom=linux-wireless-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by agentk.vger.email (Postfix) with ESMTP id 4383480ABDD6; Wed, 11 Oct 2023 02:20:35 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at agentk.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231374AbjJKJUd (ORCPT + 52 others); Wed, 11 Oct 2023 05:20:33 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44044 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231144AbjJKJUd (ORCPT ); Wed, 11 Oct 2023 05:20:33 -0400 Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id EC41691; Wed, 11 Oct 2023 02:20:31 -0700 (PDT) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 73AB2C433C8; Wed, 11 Oct 2023 09:20:30 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1697016031; bh=ju74xlAz+WDMwoyepe65xhltEQNC+JPoiTlVmjOaOko=; h=Subject:From:In-Reply-To:References:To:Cc:Date:From; b=ExCST8SGknwh7LJsiMX5ttjhAskvHlMNFC5dQwQqOlA0z7+je2lOeZw3T7N9czsb5 uknL6sF3w6JVNKuQDaE7RvxzalH3Ck6jyXNiGwk7TDxNAQGbvVdlXpsOOl3/9y9Mv4 9zmdkl4VxktJNfnjO9TVd8RgTYcPJ6XkOOSgHcOubBW/J8Iv5ZmnN52SjftuwBBeMd WvZNZjNMRWh5BhZ5JE98EIiDmej7i8r4Bw044xiJ/fs+XHLntXwi9lMqKn11c2QXj5 g2Pl2HHYYy30dVjWjQc27QczOKXs2WU8gTKpO23YefjYDoCAdl6RodgSxj2Q0DxLtE 3YI5N5Ap01zTA== Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: Re: [next] wifi: hostap: Add __counted_by for struct prism2_download_data and use struct_size() From: Kalle Valo In-Reply-To: References: To: "Gustavo A. R. Silva" Cc: linux-wireless@vger.kernel.org, linux-kernel@vger.kernel.org, "Gustavo A. R. Silva" , linux-hardening@vger.kernel.org User-Agent: pwcli/0.1.1-git (https://github.com/kvalo/pwcli/) Python/3.11.2 Message-ID: <169701602833.2760941.2948588134703156601.kvalo@kernel.org> Date: Wed, 11 Oct 2023 09:20:30 +0000 (UTC) X-Spam-Status: No, score=2.4 required=5.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,MAILING_LIST_MULTI, RCVD_IN_SBL_CSS,SPF_HELO_NONE,SPF_PASS autolearn=no autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on agentk.vger.email Precedence: bulk List-ID: X-Mailing-List: linux-wireless@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (agentk.vger.email [0.0.0.0]); Wed, 11 Oct 2023 02:20:35 -0700 (PDT) X-Spam-Level: ** "Gustavo A. R. Silva" 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 via CONFIG_UBSAN_BOUNDS (for > array indexing) and CONFIG_FORTIFY_SOURCE (for strcpy/memcpy-family > functions). > > While there, use struct_size() helper, instead of the open-coded > version, to calculate the size for the allocation of the whole > flexible structure, including of course, the flexible-array member. > > This code was found with the help of Coccinelle, and audited and > fixed manually. > > Signed-off-by: Gustavo A. R. Silva > Reviewed-by: Kees Cook Patch applied to wireless-next.git, thanks. 5cf47dc14158 wifi: hostap: Add __counted_by for struct prism2_download_data and use struct_size() -- https://patchwork.kernel.org/project/linux-wireless/patch/ZSRXXvWMMkm7qqRW@work/ https://wireless.wiki.kernel.org/en/developers/documentation/submittingpatches