Received: by 2002:a05:7412:d8a:b0:e2:908c:2ebd with SMTP id b10csp453669rdg; Tue, 10 Oct 2023 15:51:22 -0700 (PDT) X-Google-Smtp-Source: AGHT+IGBDEWNhcHpi9BulayjmB9sfqpD/SZ5B5FQ7J52Oa2vMXLhA6SOdDSBceWGCIhGAYJv6OL5 X-Received: by 2002:a17:902:e80a:b0:1c3:9928:7b28 with SMTP id u10-20020a170902e80a00b001c399287b28mr22235011plg.6.1696978282031; Tue, 10 Oct 2023 15:51:22 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1696978282; cv=none; d=google.com; s=arc-20160816; b=SOMYr1De6P71R+oHCNIJB1kCYvqO3J4bGz2AE4KdJqqSMfpBoq8z9NnQBlL/tyc+0s O8d//Muf8XZjOHsf+/qvARKJ8hWrHzxSCA1DZvpnXSrb9bhtclQV6zwiI/YpRgbkhzm+ kwajdGDFvdBzLTYZdwiIjOIP8vzdkig8+h8XXolxtQqyNvxBQBjR+62FvoiEGBH/xftV OQFMNwCSs3KoYCa5rVszBxHWU/GSe0rY2rUOV4xWvKQln0xstBZpICn1QvOumAQWBg8S EJvWV8NqLdZCBMFV2sHPUhICGpdlpxLRoalV08ZlP2MGC/bJjDwfUQL691L4wUlLDNn8 itdg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=N2ph4e3aw3myowCBYVpWGXZK0YS95STvUJ4nSeseoUo=; fh=R9Sxey3NpgiC/uWxviPYLAoIe+ZTR0vWhPTQypPARQc=; b=CazLgOUmHGoZDxNG6szuUE1qg99O6xZEK87RvM0eDkswvuzDpjDDQRbgnwcRgW0fmq lrnnSAF07QdNDJPVYoQdMbSwStdK3b2gqCq4aUr/QEUaxBonWz7xBuOoMiQAq4/fGNL/ cR/OFGczIqg4+aZcFge/4wcEzvMt2FTsu7kDjuoZAwR/PGz5dhBtHJPr8Mo3ed+Pt8/e qeg0l2+vj/NI4yEtvg6crspfAFpuWJzqm6lJgIps42IM7+4t+T08SJVtPsWXrTpZJS+E 08E4u4NfxR7ABH3stKP5/KpexmOFGY6SELrHIQWkeiKcixNw5W3AhuXpDGFKxA5rc0nR nlLw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b=gI4e5XqT; spf=pass (google.com: domain of linux-wireless-owner@vger.kernel.org designates 23.128.96.34 as permitted sender) smtp.mailfrom=linux-wireless-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=chromium.org Return-Path: Received: from howler.vger.email (howler.vger.email. [23.128.96.34]) by mx.google.com with ESMTPS id v10-20020a170902b7ca00b001c5de4a5b4esi42761plz.597.2023.10.10.15.51.21 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 10 Oct 2023 15:51:22 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-wireless-owner@vger.kernel.org designates 23.128.96.34 as permitted sender) client-ip=23.128.96.34; Authentication-Results: mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b=gI4e5XqT; spf=pass (google.com: domain of linux-wireless-owner@vger.kernel.org designates 23.128.96.34 as permitted sender) smtp.mailfrom=linux-wireless-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=chromium.org Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by howler.vger.email (Postfix) with ESMTP id 3236B803DB9C; Tue, 10 Oct 2023 15:50:44 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at howler.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234684AbjJJWuf (ORCPT + 52 others); Tue, 10 Oct 2023 18:50:35 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37264 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1344171AbjJJWuX (ORCPT ); Tue, 10 Oct 2023 18:50:23 -0400 Received: from mail-pg1-x533.google.com (mail-pg1-x533.google.com [IPv6:2607:f8b0:4864:20::533]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 4828F184 for ; Tue, 10 Oct 2023 15:50:09 -0700 (PDT) Received: by mail-pg1-x533.google.com with SMTP id 41be03b00d2f7-58e119bb28eso274594a12.1 for ; Tue, 10 Oct 2023 15:50:09 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; t=1696978208; x=1697583008; darn=vger.kernel.org; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:from:to:cc:subject:date:message-id:reply-to; bh=N2ph4e3aw3myowCBYVpWGXZK0YS95STvUJ4nSeseoUo=; b=gI4e5XqTajQKEPi50KbEZB0HoCzzK9XziB5Cyf6iK1MfUkMOvFoz7eMMAPIsDeVuYB whc3Bxpkz+z7sIqHcb1JOsz+bl8lzh7oHBYpIl5EtqWKdZ0SGaCBL8vmDHQrZPviLJc+ E1VCq6FAD6B7yqKCTDHxrgcOD96qjZVQJqgY8= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1696978208; x=1697583008; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=N2ph4e3aw3myowCBYVpWGXZK0YS95STvUJ4nSeseoUo=; b=h26xTNstGUxSGIaR+QyPTgaQCZ3an9W5l3wbecBV9jpX6ikBPS9cXDT5heiFjc14nB Gh89i5U0Qqoj1cMiFySdpyipCuKxP8ZGfWhpyrdZ2y9r5EHWBz26xdZRCy65G43+tLVU hRm4O0IuA+0/0hnXMWWRHrAQ8J5YHXy4KQlMv8JEFDFrqVXudNtjSgr1L6jCA2+8KTQs n96iW6GWeXv0KXdG2QXVQxuOC/23woIJWdwAuqHhAIzyRr84QlJIZcjNUmWXuWylD0EW PSAQbWFm4hdTMOzDmsrGUDS9827Vq34blgn8jIGoOBNhxXnBk8JXekEP2DUi8iLU2T45 hPhQ== X-Gm-Message-State: AOJu0YzFyRujc7cyYY7QteKVziv2ZleCVly/iEnfPcbzt4qzbYRPTLyt CsZV9DFRpcjLn2bpvFa3QE4bgA== X-Received: by 2002:a17:90b:4b47:b0:27c:edf7:db4a with SMTP id mi7-20020a17090b4b4700b0027cedf7db4amr4226933pjb.16.1696978208228; Tue, 10 Oct 2023 15:50:08 -0700 (PDT) Received: from www.outflux.net (198-0-35-241-static.hfc.comcastbusiness.net. [198.0.35.241]) by smtp.gmail.com with ESMTPSA id bx4-20020a17090af48400b0026b76edd607sm10596603pjb.15.2023.10.10.15.50.07 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 10 Oct 2023 15:50:07 -0700 (PDT) Date: Tue, 10 Oct 2023 15:50:06 -0700 From: Kees Cook To: "Gustavo A. R. Silva" Cc: Kalle Valo , linux-wireless@vger.kernel.org, linux-kernel@vger.kernel.org, linux-hardening@vger.kernel.org Subject: Re: [PATCH][next] hostap: Add __counted_by for struct prism2_download_data and use struct_size() Message-ID: <202310101549.E09DE6F@keescook> References: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: X-Spam-Status: No, score=2.7 required=5.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, 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 howler.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 (howler.vger.email [0.0.0.0]); Tue, 10 Oct 2023 15:50:44 -0700 (PDT) X-Spam-Level: ** On Mon, Oct 09, 2023 at 01:41:18PM -0600, 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 I realize I didn't actually send my R-b for this thread, so here it is: Reviewed-by: Kees Cook :) -- Kees Cook