Received: by 2002:a05:7412:37c9:b0:e2:908c:2ebd with SMTP id jz9csp2911483rdb; Fri, 22 Sep 2023 11:46:26 -0700 (PDT) X-Google-Smtp-Source: AGHT+IEJ7dpGaO1uGpllDiEbrTU7bJGZBcI4hkwVXzUCLo3krwl2bSCXKkkYaqa3+yMqaU+OYnpt X-Received: by 2002:a05:6e02:1c08:b0:350:f0bb:6a33 with SMTP id l8-20020a056e021c0800b00350f0bb6a33mr529020ilh.13.1695408385843; Fri, 22 Sep 2023 11:46:25 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1695408385; cv=none; d=google.com; s=arc-20160816; b=kMUkemXcgYIWK21509nLlvpcDY0M6yjOe8psTo/5+JZSaM1tjcUBaveNt97GhwulgF Qvhbsq5JON9r+kzOljKGNwC8RfTvfLvIIWbLpTbPN1xFJkwBmoJl3OhWwBvavrgwBvpa MwnMc6H7K2q2QnQTR/SfQL+/XIuhfkl99kuKv72j0RHSDkKZ+xXKGVMMsj4zyOR3y9zE 3J9is3hfFCmbD/VLJHXNyV30MGUYkSAcLpVW8qQhfCgk9iIqcfZOy3VR/8hVlwVHJ9Om L14vLedmIkhstMhul+A5SDdhg0aIL1+mH9oMwMDNwH94p8heTKjCB5Kle4RvY7V8PGUq dEKA== 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 :message-id:date:subject:cc:to:from:dkim-signature; bh=maP8YXhB08F9LY5OG0jMprTbidCF0YS16nloYI5WUaA=; fh=10DftjpjJz8SI/CRvjefgPVRZU7+vGy87QAWHml6ct4=; b=UQgG0PH+5PtWUvtwgbIg0mKi8pNQb8Idy4QlO2Pngzxuz5eZkcXdKtmhToNfN6HJzL Hi7U6mkt6Dgo4DM5ZJwuidnS/kucNoVb2naV+jIxsmUoBNTH6toyQg/tmD9OurrVI5VB UOrVluLx2gKkNQeTK42QhQEmZOttS83y7sRDWj0KVzv4xAcDWGgJzAd8VY/DrxNhX0/8 N0MGnW/RhPMrIooQWbzFZHLZPAncBN2kGiWfhJ5xsbON7gPD4fiUu0lwnMtXYfkp1OKu O0+c1QSwY8d3J5zyla64C1PlQvulfok/WRUhcL2kW0p+SfFNbCr7DaB8dZbRL9LCABcd sOWw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b=jPMGIykJ; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.38 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 fry.vger.email (fry.vger.email. [23.128.96.38]) by mx.google.com with ESMTPS id h70-20020a638349000000b00573f885c4edsi4110332pge.368.2023.09.22.11.46.04 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 22 Sep 2023 11:46:25 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.38 as permitted sender) client-ip=23.128.96.38; Authentication-Results: mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b=jPMGIykJ; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.38 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 fry.vger.email (Postfix) with ESMTP id 5169A809FA5C; Fri, 22 Sep 2023 10:32:52 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at fry.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229801AbjIVRcv (ORCPT + 99 others); Fri, 22 Sep 2023 13:32:51 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:36776 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232910AbjIVRcd (ORCPT ); Fri, 22 Sep 2023 13:32:33 -0400 Received: from mail-pj1-x1031.google.com (mail-pj1-x1031.google.com [IPv6:2607:f8b0:4864:20::1031]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id EA92A1B2 for ; Fri, 22 Sep 2023 10:32:17 -0700 (PDT) Received: by mail-pj1-x1031.google.com with SMTP id 98e67ed59e1d1-274dd099cd5so1798188a91.3 for ; Fri, 22 Sep 2023 10:32:17 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; t=1695403937; x=1696008737; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date:message-id:reply-to; bh=maP8YXhB08F9LY5OG0jMprTbidCF0YS16nloYI5WUaA=; b=jPMGIykJNivSzumkyPyfRksE80LIgODcWlNzZ0+aEgWRJvP41S1k8emA8EOw8WVeR/ cGoAG6ZpZcL54uv4D5sEFw3p8xT5zzuJcXyq5P4Cap63VExYlV4ZGUv14bkbPyHk8YG3 Yg9hHCz4rbId2iwFvqSSLEeZnjbNd9ekxCfVU= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1695403937; x=1696008737; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=maP8YXhB08F9LY5OG0jMprTbidCF0YS16nloYI5WUaA=; b=UNXqixh73bYKdC88wpBUQdHMPXY4COrXM/hFDPxXpQeUzPv/nzN2Awvyy4uYj3Bd1v GdmaV01lYAhbTmBb9m4Ff90tH2lkMoMday+N2O8UCCxiNqafuaSB80eWe9MYCKqYwt9E PzlRfNkCPSmHPhvC3+1qBLJmkc2z48Pb1H60M5dAS9PFb7fIeM2q82BdnNGl1plXNP9F DfRYbuc+yKTybHbViFW92LHMoJCNfhHLtRson6PnlT5FJp4ULRFyUnJ08dYB97pyi6IY b4cLlq+ooqMeOYo8Zts1vAW7bmuIAVUHgQm5zF+4I4h6dTklCMdlyih7vcXC1Gi+Wts7 gMxQ== X-Gm-Message-State: AOJu0Yxf8nzhK+9sRK7bhlqfWUP3s9afXqVfjny+4HMwfkUFHYhnxw5T wpDmetQExJwqrJIbVgO77dydjA== X-Received: by 2002:a17:90b:2247:b0:271:c314:a591 with SMTP id hk7-20020a17090b224700b00271c314a591mr349153pjb.47.1695403937438; Fri, 22 Sep 2023 10:32:17 -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 n20-20020a17090a929400b00274ea190852sm3464464pjo.6.2023.09.22.10.32.16 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 22 Sep 2023 10:32:17 -0700 (PDT) From: Kees Cook To: David Airlie Cc: Kees Cook , Emma Anholt , Evan Quan , Alex Deucher , =?UTF-8?q?Christian=20K=C3=B6nig?= , "Pan, Xinhui" , Daniel Vetter , Xiaojian Du , Huang Rui , Kevin Wang , Hawking Zhang , Jani Nikula , Joonas Lahtinen , Rodrigo Vivi , Tvrtko Ursulin , Chris Wilson , John Harrison , Andi Shyti , Matthew Brost , 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, dri-devel@lists.freedesktop.org, intel-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 0/9] drm: Annotate structs with __counted_by Date: Fri, 22 Sep 2023 10:32:05 -0700 Message-Id: <20230922173110.work.084-kees@kernel.org> X-Mailer: git-send-email 2.34.1 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 X-Developer-Signature: v=1; a=openpgp-sha256; l=2029; i=keescook@chromium.org; h=from:subject:message-id; bh=YV47XR+Dr1NybdP/JWrsHmoQYKkqVQbnuP88RsqPU7s=; b=owEBbQKS/ZANAwAKAYly9N/cbcAmAcsmYgBlDc+dsj3+Vh5qemjuEPg29sGFlFmzA+yi/v3Rh XtvZqOfqaGJAjMEAAEKAB0WIQSlw/aPIp3WD3I+bhOJcvTf3G3AJgUCZQ3PnQAKCRCJcvTf3G3A JiHwEACLzTcgywMl1i+ngflg0YluRoEeJQAxOBHxuE5H6DZMdzVg2q1O7AYcZvuFgGEob07505+ PzEtpDzTZH/46SXLgI4Sgl0XmudzghRjlp0XTK1UC22xnOBNM9k0OIJif5wStFA/0uiZLRrHII7 A/+AqzgBiY88gBa4O+x8Vj0+JBJGnDCr0QudEO6XyIcvvmLLgiRCce78vOKBXTXq6Dktknkayr7 GSRsmx3ZTid9GiUDFYYu7/JLETFdk3ZPoT0iX6O1OocWU9VVd8IE71u38u38X+AdokHQtuEXbCe GXNdGJrLV9VqJ6qvypVr3S1EhagL/Z+f7Xz/GMY6nMu+6H9YM0Nbh7PQ8fyD/y9rlT2jcsSJY3r eqE3X+ATIdov/4puub/Z5OUm9R4z3dXWHGfnc/vb5l24ZPzLfhFdjlnbl4LYKnZyxK/lH0OGSkH 9Wks6MuSdRE+bNJFV0VibfzZlV0+wemFXXSlAxxVQGcZ7CWgQaV2w7wE1Y3AMJLRthOuVUU6Kts VfGI7p8XZRScEI6mnWSh8w9zLZOftTtdiCxcVj1gdXRTx2/K3Xfv0UkoHgdzOBqTTEPqGetCOjs WS30PIjoUXxpO+DRvCTjySDsnQXksC7AsjBRhvnXyIR8tgFSEAywP6FcLYaX3ltdG79BvgAkkzq Bs7QmlF kGRGYttQ== 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 fry.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 (fry.vger.email [0.0.0.0]); Fri, 22 Sep 2023 10:32:52 -0700 (PDT) Hi, This is a batch of patches touching drm for preparing 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 to structs that would benefit from the annotation. Since the element count member must be set before accessing the annotated flexible array member, some patches also move the member's initialization earlier. (These are noted in the individual patches.) -Kees [1] https://github.com/kees/kernel-tools/blob/trunk/coccinelle/examples/counted_by.cocci Kees Cook (9): drm/amd/pm: Annotate struct smu10_voltage_dependency_table with __counted_by drm/amdgpu/discovery: Annotate struct ip_hw_instance with __counted_by drm/i915/selftests: Annotate struct perf_series with __counted_by drm/msm/dpu: Annotate struct dpu_hw_intr with __counted_by drm/nouveau/pm: Annotate struct nvkm_perfdom with __counted_by drm/vc4: Annotate struct vc4_perfmon with __counted_by drm/virtio: Annotate struct virtio_gpu_object_array with __counted_by drm/vmwgfx: Annotate struct vmw_surface_dirty with __counted_by drm/v3d: Annotate struct v3d_perfmon with __counted_by drivers/gpu/drm/amd/amdgpu/amdgpu_discovery.c | 2 +- drivers/gpu/drm/amd/pm/powerplay/hwmgr/smu10_hwmgr.h | 2 +- drivers/gpu/drm/i915/selftests/i915_request.c | 2 +- drivers/gpu/drm/msm/disp/dpu1/dpu_hw_interrupts.h | 2 +- drivers/gpu/drm/nouveau/nvkm/engine/pm/priv.h | 2 +- drivers/gpu/drm/v3d/v3d_drv.h | 2 +- drivers/gpu/drm/vc4/vc4_drv.h | 2 +- drivers/gpu/drm/virtio/virtgpu_drv.h | 2 +- drivers/gpu/drm/vmwgfx/vmwgfx_surface.c | 2 +- 9 files changed, 9 insertions(+), 9 deletions(-) -- 2.34.1