Received: by 2002:a05:7412:37c9:b0:e2:908c:2ebd with SMTP id jz9csp3037196rdb; Fri, 22 Sep 2023 16:32:53 -0700 (PDT) X-Google-Smtp-Source: AGHT+IGZB9P01tjTGl2tkrNqV439+9DRjKfAHdJkLKkORS2XM/+mT4N5SNNc4cCg4SCeW/t0PIZ+ X-Received: by 2002:a05:6808:23d1:b0:3a7:6f16:b549 with SMTP id bq17-20020a05680823d100b003a76f16b549mr1363066oib.49.1695425573062; Fri, 22 Sep 2023 16:32:53 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1695425573; cv=none; d=google.com; s=arc-20160816; b=SFcIJT7x/4XcvEOzqd/t5JOdB4ihLqdEHOf32QuZt61YQlIYX8w7GRemfWQvecOH5f 4FnCXKEUd8FdKnm3Hh0OCEZrk5gOL8CTBOXZVHz6+CD9mJhClSquCnO2AGsqoWv7ZwtZ 3yM385vY56WVkfTaLkb4qsh079puTobPOajwY5u2AWdAvae45RsM8v2Uc9Vx/AGyjpCM GCmTD48nM8yOAdvgsjxhy8S4a46517QH4fo5je8TunSWetQL9aoPmw3z00QiVSi25OOJ bGAqoAs8iwqQu3CnB6KZXkQ1R5ZJ9E74xB1w64Qi8+2e1/isKhOY1ng2LAAVjtFZzs+2 RWgg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=Q96X+e6e2GphA8WEKNidppfkY54O3UO5SgYggFHsXis=; fh=keu27XUl7/uUnb1ynG/6JtSlhduLyFi36znJb9y41Pk=; b=wVorPhWD4w5E6uvn2+MVGjOajO9pTWqf+4VIdOLkTV2Jl4wHu3R54eeNMd+GxwupH6 3iiQT3wiq4H6BlXcQvtcC7eb4kmRrNZ/KHp+Iph8IRyGNFLqejn+YWWLVNVXqKkaqd3t 2ni+SPIkgnD5xu3SRItDctmoEbVi92j3B6l5sSJaWy6ChDwLFOWxhAhRgqDr9/npJiv9 SeCvAWBR4PO959GgiPW+7FHXq7rNElmwhw9jQaEoeXctz7Ai+6LcGvU4W8arFNHZgHhQ OcjfsAOnBRIge+LUnPc/GkMzKrqri0BueUemZ9mtjW7FTKBK89ZVvhXqRqeNEoBl4w/F LXGg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b=NPXZjHvy; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:6 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=chromium.org Return-Path: Received: from pete.vger.email (pete.vger.email. [2620:137:e000::3:6]) by mx.google.com with ESMTPS id t22-20020a056a0021d600b00690b80126b9si4728038pfj.142.2023.09.22.16.32.37 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 22 Sep 2023 16:32:53 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:6 as permitted sender) client-ip=2620:137:e000::3:6; Authentication-Results: mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b=NPXZjHvy; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:6 as permitted sender) smtp.mailfrom=linux-kernel-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 pete.vger.email (Postfix) with ESMTP id 521C082C4019; Fri, 22 Sep 2023 10:33:30 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at pete.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233539AbjIVRdS (ORCPT + 99 others); Fri, 22 Sep 2023 13:33:18 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49332 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233343AbjIVRcn (ORCPT ); Fri, 22 Sep 2023 13:32:43 -0400 Received: from mail-pl1-x62d.google.com (mail-pl1-x62d.google.com [IPv6:2607:f8b0:4864:20::62d]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A3A8210D5 for ; Fri, 22 Sep 2023 10:32:22 -0700 (PDT) Received: by mail-pl1-x62d.google.com with SMTP id d9443c01a7336-1c3bd829b86so21494545ad.0 for ; Fri, 22 Sep 2023 10:32:22 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; t=1695403942; x=1696008742; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=Q96X+e6e2GphA8WEKNidppfkY54O3UO5SgYggFHsXis=; b=NPXZjHvy8DIF9H/py75WTffi2Hgh5VL59J+34EDw/TkjIkHlVAo9ft1lJdNvk/9wMH hL7loSmLXoRReiTt26X4GAAR61iCJktd1BKnqBm02fB8tNZ9apwCdgHK5HJFZ0n4fLBf HI3icySjCOqxel5ae4bHHr0ZpceA3GRXT/jqU= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1695403942; x=1696008742; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=Q96X+e6e2GphA8WEKNidppfkY54O3UO5SgYggFHsXis=; b=E+zMuSsSz/4L4KCFeiyYorQcJdKP0O+mtuehrD/tanfJTtncPPbzsZhwrRTfkaT/5x O7eTqhxhBe7TXdMjYOX7LK2EW8m72KitiWVQ3KwYNdmJ2RpSQlv9BNeyRd8jqtLOo4Qd hSXk9bi4s2MpwEmR4SL6vIAgAD/0ed4eZd8ajuMA5VAWsI77m2dBF3LUay5VSeGptIPv 43cp2YeHgdem9GWpgtZhDxXB/RpB20Wvzcmguvh5b861YFhy6rikh2T8DeLSG5q0rl2J WG6T93YnoF9Wg8rkK5vHUWPfclNXYuJdP3LscCvS+POSVrSm9SspLGRGsJrH35mQrkZY cypA== X-Gm-Message-State: AOJu0Yz0bMnbcr+NEyIfxhwwW57LKVWjCU6ArzLiQ5batskLsrPzsAE+ F48m+BUPk25uAmGWQ3ebmZtgXg== X-Received: by 2002:a17:902:e843:b0:1c5:69fa:23e9 with SMTP id t3-20020a170902e84300b001c569fa23e9mr100975plg.58.1695403941990; Fri, 22 Sep 2023 10:32:21 -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 p11-20020a170902eacb00b001bf5c12e9fesm3758147pld.125.2023.09.22.10.32.17 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 22 Sep 2023 10:32:19 -0700 (PDT) From: Kees Cook To: David Airlie Cc: Kees Cook , Jani Nikula , Joonas Lahtinen , Rodrigo Vivi , Tvrtko Ursulin , Daniel Vetter , Chris Wilson , John Harrison , Andi Shyti , Matthew Brost , intel-gfx@lists.freedesktop.org, dri-devel@lists.freedesktop.org, Emma Anholt , Evan Quan , Alex Deucher , =?UTF-8?q?Christian=20K=C3=B6nig?= , "Pan, Xinhui" , Xiaojian Du , Huang Rui , Kevin Wang , Hawking Zhang , Rob Clark , Abhinav Kumar , Dmitry Baryshkov , Sean Paul , Marijn Suijten , Bjorn Andersson , Ben Skeggs , Karol Herbst , Lyude Paul , Maxime Ripard , David Airlie , Gerd Hoffmann , Gurchetan Singh , Chia-I Wu , Zack Rusin , VMware Graphics Reviewers , Melissa Wen , Nathan Chancellor , Nick Desaulniers , Tom Rix , Le Ma , Lijo Lazar , Yifan Zhang , Prike Liang , Lang Yu , Tejas Upadhyay , Nirmoy Das , Andrzej Hajda , Neil Armstrong , Kuogee Hsieh , linux-kernel@vger.kernel.org, amd-gfx@lists.freedesktop.org, linux-arm-msm@vger.kernel.org, freedreno@lists.freedesktop.org, nouveau@lists.freedesktop.org, virtualization@lists.linux-foundation.org, llvm@lists.linux.dev, linux-hardening@vger.kernel.org Subject: [PATCH 3/9] drm/i915/selftests: Annotate struct perf_series with __counted_by Date: Fri, 22 Sep 2023 10:32:08 -0700 Message-Id: <20230922173216.3823169-3-keescook@chromium.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230922173110.work.084-kees@kernel.org> References: <20230922173110.work.084-kees@kernel.org> MIME-Version: 1.0 X-Developer-Signature: v=1; a=openpgp-sha256; l=1705; i=keescook@chromium.org; h=from:subject; bh=SbNV7tt6Hho3aemFjM+WsFyDqpMFvSNtroJg7EF/6LY=; b=owEBbQKS/ZANAwAKAYly9N/cbcAmAcsmYgBlDc+e99M+BFyGmat9Yjgpanw6UekhSMQhhAVfe PzecbdVf2uJAjMEAAEKAB0WIQSlw/aPIp3WD3I+bhOJcvTf3G3AJgUCZQ3PngAKCRCJcvTf3G3A JhPmD/oDoTfSn61jeN+hZ6qtbqMVL0umbxgqdZnXY/WBbLuBKV20tcaMAcUgkDgD7IZTf9vLT7N QvsK/I3NzdeyXN9KRjg9P26c5TGRnuFhT5ow/Mmpjw2ZfwY/adYsynGhgMsY1zCzocr9Klih2M5 ONqETCgHopA10PwXUTZcfeylbqK62rRaYAWtkuoi0RcYjB0ba0MiguwtlB6nrG6fwv2owEKE9yZ q2M6NVTsjfrdnESUtkpr+ZQMSdTP4DYj6WZCs8PEing/sqS9G43U/93adZtoUdXHfx6OIvtf4kR QVJDI5f2FtS/OLpfsJPETvUFATNLl9zt+qYEEI6Xo/nwVAIDi10lef4gFjjLtPRlK+1R5w0hwDl vKJUW0WgT4cnNhXnSosMUxrlYOzDiiFUv22K7MRCjwllhPuoEqIvmEu2skXTbfOi++COJZQENGW mjr4E/cj8Pue9+KM7OxnSvfWccW9jLZfobZ+Mt3QO0uwzIKFw3tbN6roSBWKQjPzGVWZBhoB7P/ YBx8LyLPlIme4RIAinnRTvKcRBVmPKq0z5qb+ZrfdbS5SyUax0buA8IufSmAFbFNMVWiehiR7kj m3qIzz42RIlit5ahExdpEPXkGeqqxLI86EouMV1p14sfdA6bPnL2FdLAyVYLHh92VJ7BRKvGmB7 gVsy2dUkMQ94AOw== X-Developer-Key: i=keescook@chromium.org; a=openpgp; fpr=A5C3F68F229DD60F723E6E138972F4DFDC6DC026 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-0.9 required=5.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on pete.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 (pete.vger.email [0.0.0.0]); Fri, 22 Sep 2023 10:33:30 -0700 (PDT) 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 perf_series. [1] https://github.com/kees/kernel-tools/blob/trunk/coccinelle/examples/counted_by.cocci Cc: Jani Nikula Cc: Joonas Lahtinen Cc: Rodrigo Vivi Cc: Tvrtko Ursulin Cc: David Airlie Cc: Daniel Vetter Cc: Chris Wilson Cc: John Harrison Cc: Andi Shyti Cc: Matthew Brost Cc: intel-gfx@lists.freedesktop.org Cc: dri-devel@lists.freedesktop.org Signed-off-by: Kees Cook --- drivers/gpu/drm/i915/selftests/i915_request.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/gpu/drm/i915/selftests/i915_request.c b/drivers/gpu/drm/i915/selftests/i915_request.c index a9b79888c193..acae30a04a94 100644 --- a/drivers/gpu/drm/i915/selftests/i915_request.c +++ b/drivers/gpu/drm/i915/selftests/i915_request.c @@ -1924,7 +1924,7 @@ struct perf_stats { struct perf_series { struct drm_i915_private *i915; unsigned int nengines; - struct intel_context *ce[]; + struct intel_context *ce[] __counted_by(nengines); }; static int cmp_u32(const void *A, const void *B) -- 2.34.1