Received: by 2002:a89:413:0:b0:1fd:dba5:e537 with SMTP id m19csp936466lqs; Fri, 14 Jun 2024 09:41:40 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCVu0eYmo1Di23x4W+5j/nD28KfcZ0+NPzdI+sVbL6pGmeQqFjeJhGHREsipOnI/FLIZNxfw/2Kq5mzkccGlQa6sQvzP/oxDoZF/TaYNWQ== X-Google-Smtp-Source: AGHT+IE+47ZhNBP1sU3ehRvT8h/EIAcdp9iUSwe4BKv3NLk1SN/I/1K7VwpALSISyqzeQArlTzdL X-Received: by 2002:a92:c268:0:b0:375:a994:6dce with SMTP id e9e14a558f8ab-375e0e3935amr35840035ab.18.1718383299765; Fri, 14 Jun 2024 09:41:39 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1718383299; cv=pass; d=google.com; s=arc-20160816; b=OrDixQT0141xoRzzLtn6fT/W2lc28ZOIhuBpghK+PSCnC+gsKMLWiZtxqD2+CFjOc0 9jzfr0lFpAvvdANq/VdlwFFrPxvLoYk8+7xQWJBOgXAhZmukKY8ceG8NVHejOBVXkdXr iczgPvJM7veHan5V7UnOdtP46d4B6uHhorF+UHl21+TJ97K7M91hMwS8NGEgzbQIX1eC UrY66Mnu4LBYb9leeYHBife+B020z2iPx5pWzUP1N/lf/WxRtnO63ZvGnQ1BXj28oqFc IDSSsr/FOhaT5IoSwRP0mL1D1rBG9LYTY9Msx1ITYkETjgimFVwRJsLLdMYOPY4jqORi K6MA== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:message-id:date:subject:cc:to :from:dkim-signature; bh=iew86RGc22LJ+Q/8TMphmmkcMzmxkXz0kaXfqIW+KKw=; fh=O9Ck7+0p0mjUT/WjWCOmk9d/HyBiKO8sciaBmqoJFPk=; b=xizAIV8t0PJ6FV8LJwb87COO8ERxdGgwCYMhO4WcotasJS7eTZqvS+A93kPQHQoyyG 0907SHBBTHDIdfj8X3LvMdLhdok0Ngi6vbyhKEuEjzSFm3nx6Z6ieZr47h7rwpDDtrRU RizfKX9VWMk2zWrURlSm5DQ7dxN1U0HBjbADtTgY1T3TTCzZmglK6+Q3MRKY1YahH3mD Ua+bXLZ44icuz++WtbydNLf8w5YvLIskkuI4R7lb20uYETwtInLMDLmykQLlSRyQ7CKA rYmt3LItXT7EeIHtYcbZPegrNb7g6ah3Srcs4HbrWlfjrxiZEe/ecLIzM5ntKUcjglvF qakw==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@wanadoo.fr header.s=t20230301 header.b=mfApwInj; arc=pass (i=1 spf=pass spfdomain=wanadoo.fr dkim=pass dkdomain=wanadoo.fr dmarc=pass fromdomain=wanadoo.fr); spf=pass (google.com: domain of linux-kernel+bounces-215198-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-215198-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=QUARANTINE sp=NONE dis=NONE) header.from=wanadoo.fr Return-Path: Received: from sy.mirrors.kernel.org (sy.mirrors.kernel.org. [2604:1380:40f1:3f00::1]) by mx.google.com with ESMTPS id 41be03b00d2f7-6fee53a1319si3675654a12.635.2024.06.14.09.41.39 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 14 Jun 2024 09:41:39 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-215198-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) client-ip=2604:1380:40f1:3f00::1; Authentication-Results: mx.google.com; dkim=pass header.i=@wanadoo.fr header.s=t20230301 header.b=mfApwInj; arc=pass (i=1 spf=pass spfdomain=wanadoo.fr dkim=pass dkdomain=wanadoo.fr dmarc=pass fromdomain=wanadoo.fr); spf=pass (google.com: domain of linux-kernel+bounces-215198-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-215198-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=QUARANTINE sp=NONE dis=NONE) header.from=wanadoo.fr Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sy.mirrors.kernel.org (Postfix) with ESMTPS id C8A5CB24AF6 for ; Fri, 14 Jun 2024 16:08:58 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 6F54E16F0D1; Fri, 14 Jun 2024 16:08:49 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=wanadoo.fr header.i=@wanadoo.fr header.b="mfApwInj" Received: from msa.smtpout.orange.fr (smtp-74.smtpout.orange.fr [80.12.242.74]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id F41E36FCB; Fri, 14 Jun 2024 16:08:45 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=80.12.242.74 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1718381328; cv=none; b=J9Jb3b1+zzNgCnr3dGQfmhGsdYA9tiTZaBwbUgCZIj8BjrTc4lmXp7Sb3VGWjy4/gpFTvcUzMr4k4qkXqvX8SWvEdp9vMSw+RNzwcNBaqz0Z7lETF0dB/NZQtcjPak3ePMHHemtayGMO7vbjw9aKJb6EGLcyLG9Eht+B8epT93E= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1718381328; c=relaxed/simple; bh=R8H8MXJyPb1YM2V92M76ao7oPk/gsYPlvbPUU2JSefY=; h=From:To:Cc:Subject:Date:Message-ID:MIME-Version; b=K8a5pf1y9rmuisSYnqYc2TSWyDXuTZuwqOBT89iD0Gj4sQwVkGYLroHrEHWvEsqJfFngi+EaV2AwmcOkVyEEHbBme2ATyWeNE1vtUsXsDMLrkeFy+AerbiQD33ji9hXpYGzOYspTvj1iHIlLJQjsAiVRuJGAU19+4QucueYzQcE= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=wanadoo.fr; spf=pass smtp.mailfrom=wanadoo.fr; dkim=pass (2048-bit key) header.d=wanadoo.fr header.i=@wanadoo.fr header.b=mfApwInj; arc=none smtp.client-ip=80.12.242.74 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=wanadoo.fr Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=wanadoo.fr Received: from fedora.home ([86.243.222.230]) by smtp.orange.fr with ESMTPA id I9TgsKvp3tf3yI9TgsiObM; Fri, 14 Jun 2024 18:08:37 +0200 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=wanadoo.fr; s=t20230301; t=1718381317; bh=iew86RGc22LJ+Q/8TMphmmkcMzmxkXz0kaXfqIW+KKw=; h=From:To:Subject:Date:Message-ID:MIME-Version; b=mfApwInjnFPbwpLRxOXdkb6DU8ITDBwhgC7xAdU65yUWLf8jt/8jrF4FFTIDcY2th iEaahGn2BBaAUi/aQs9YoQcdVURdTzssWNlwOQsZ+ipTuXHMZYiNHEb5C5tkqoaWaI Kp0acai4IiMym0K99Bb3/Zv/wzE0Bfy2lMIZQDHfms6thq48feafrfAdrW6X97VQRS U/ax0jsUoBKM34bKWSzTa59xi8UwuCHepVD8jIWgHGUwv1mevIKc2Q44ByIpls246K ZV9sqMX5tPORVxcb5p50B94POU8T37Dr+8N5tzNd3sf3ouUswuh6JahE3M891WLWus dcnOmDTWS+flA== X-ME-Helo: fedora.home X-ME-Auth: Y2hyaXN0b3BoZS5qYWlsbGV0QHdhbmFkb28uZnI= X-ME-Date: Fri, 14 Jun 2024 18:08:37 +0200 X-ME-IP: 86.243.222.230 From: Christophe JAILLET To: Karol Herbst , Lyude Paul , Danilo Krummrich , David Airlie , Daniel Vetter Cc: linux-kernel@vger.kernel.org, kernel-janitors@vger.kernel.org, Christophe JAILLET , dri-devel@lists.freedesktop.org, nouveau@lists.freedesktop.org Subject: [PATCH] drm/nouveau: Constify struct nouveau_job_ops Date: Fri, 14 Jun 2024 18:08:30 +0200 Message-ID: <860e9753d7867aa46b003bb3d0497f1b04065b24.1718381285.git.christophe.jaillet@wanadoo.fr> X-Mailer: git-send-email 2.45.2 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit "struct nouveau_job_ops" is not modified in these drivers. Constifying this structure moves some data to a read-only section, so increase overall security. In order to do it, "struct nouveau_job" and "struct nouveau_job_args" also need to be adjusted to this new const qualifier. On a x86_64, with allmodconfig: Before: ====== text data bss dec hex filename 5570 152 0 5722 165a drivers/gpu/drm/nouveau/nouveau_exec.o After: ===== text data bss dec hex filename 5630 112 0 5742 166e drivers/gpu/drm/nouveau/nouveau_exec.o Signed-off-by: Christophe JAILLET --- drivers/gpu/drm/nouveau/nouveau_exec.c | 2 +- drivers/gpu/drm/nouveau/nouveau_sched.h | 4 ++-- drivers/gpu/drm/nouveau/nouveau_uvmm.c | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/drivers/gpu/drm/nouveau/nouveau_exec.c b/drivers/gpu/drm/nouveau/nouveau_exec.c index e65c0ef23bc7..a0b5f1b16e8b 100644 --- a/drivers/gpu/drm/nouveau/nouveau_exec.c +++ b/drivers/gpu/drm/nouveau/nouveau_exec.c @@ -188,7 +188,7 @@ nouveau_exec_job_timeout(struct nouveau_job *job) return DRM_GPU_SCHED_STAT_NOMINAL; } -static struct nouveau_job_ops nouveau_exec_job_ops = { +static const struct nouveau_job_ops nouveau_exec_job_ops = { .submit = nouveau_exec_job_submit, .armed_submit = nouveau_exec_job_armed_submit, .run = nouveau_exec_job_run, diff --git a/drivers/gpu/drm/nouveau/nouveau_sched.h b/drivers/gpu/drm/nouveau/nouveau_sched.h index e1f01a23e6f6..20cd1da8db73 100644 --- a/drivers/gpu/drm/nouveau/nouveau_sched.h +++ b/drivers/gpu/drm/nouveau/nouveau_sched.h @@ -42,7 +42,7 @@ struct nouveau_job_args { u32 count; } out_sync; - struct nouveau_job_ops *ops; + const struct nouveau_job_ops *ops; }; struct nouveau_job { @@ -73,7 +73,7 @@ struct nouveau_job { u32 count; } out_sync; - struct nouveau_job_ops { + const struct nouveau_job_ops { /* If .submit() returns without any error, it is guaranteed that * armed_submit() is called. */ diff --git a/drivers/gpu/drm/nouveau/nouveau_uvmm.c b/drivers/gpu/drm/nouveau/nouveau_uvmm.c index ee02cd833c5e..9402fa320a7e 100644 --- a/drivers/gpu/drm/nouveau/nouveau_uvmm.c +++ b/drivers/gpu/drm/nouveau/nouveau_uvmm.c @@ -1534,7 +1534,7 @@ nouveau_uvmm_bind_job_cleanup(struct nouveau_job *job) nouveau_uvmm_bind_job_put(bind_job); } -static struct nouveau_job_ops nouveau_bind_job_ops = { +static const struct nouveau_job_ops nouveau_bind_job_ops = { .submit = nouveau_uvmm_bind_job_submit, .armed_submit = nouveau_uvmm_bind_job_armed_submit, .run = nouveau_uvmm_bind_job_run, -- 2.45.2