From nobody Sat Jul 25 19:29:01 2026 Received: from smtp.smtpout.orange.fr (smtp-79.smtpout.orange.fr [80.12.242.79]) (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 6455247DD43; Tue, 14 Jul 2026 14:06:50 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=80.12.242.79 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1784038014; cv=none; b=B/BsQs1KzWouy2ylyFP0Fn/XbynvTos5ZihhiFb5FLrnJPlgg6EW/lblAoYGArN7zAcg29+3a7bXXnQSO0g9ywIiYlXlNOX69o/2+QlOQJTo1uBFGpnl/BNtimJ1C754WlT9I1kbVkZjWpn/UWcdZAEcoKo5AGFFe36/Eo2El00= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1784038014; c=relaxed/simple; bh=+mW9FRGGIksX8xUvoSHIsB58F6Y1gNJ1lpvBBlRsUxg=; h=From:To:Cc:Subject:Date:Message-ID:MIME-Version; b=ZQeEmkvGTOQ2zF+oAT7cWVqxb9wmULSqCGzpL58ngBcYHvlD4yoG/V7JDz7B25V73+UJ39vTfbwpIWdQA/xDpKUj2kJ8sidEL0uxXW8F8wicNUYZXYFvuCyBT0WSOQAFHvNmxi1uQ1ANE2O8FDes9RZQkfAeiCp05JyXktyE7tE= 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=gA3VVSNa; arc=none smtp.client-ip=80.12.242.79 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 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=wanadoo.fr header.i=@wanadoo.fr header.b="gA3VVSNa" Received: from device-97.home ([IPv6:2a01:cb10:785:b00:26fb:aefb:6cd2:db0e]) by smtp.orange.fr with ESMTPSA id jdmYwryGUIOrpjdmYwdCwZ; Tue, 14 Jul 2026 16:06:48 +0200 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=wanadoo.fr; s=t20230301; t=1784038008; bh=+ERcgrOegSKuLIPL4or4RWuj4zLEeGH2UYWhln8zi2E=; h=From:To:Subject:Date:Message-ID:MIME-Version; b=gA3VVSNa2X5AkRN3xmG98f4kHiSorJR+Za2t0Yqu4+ZWLU+867rOUd6a8n6MUZduk +DYq95qvhFJV1wv/ho094bN436exEbGLcWj7ZhsqbSnVU7Y2TRI4GJ53Z64tYlESqp NKMM9d7IEEPxzyVEnEygy9AV+6bTCWhs5Xc3m8Y4LafYACIsC23k6/KH/f+X9JMOBW gMMyaK0VDTEdbDa/9OlYQhUiEz3PzC+g1OgLQhNqwflXfatlHj3ejvKzwcOoIYlKqh 7ZOCgxXhFVWF44s2VR71CmpgoMgZoRIHgjK+r7VSorskTemc0GX+s3gTzbkXWHSn9o jIOSI5KUX+T2g== X-ME-Helo: device-97.home X-ME-Auth: Y2hyaXN0b3BoZS5qYWlsbGV0QHdhbmFkb28uZnI= X-ME-Date: Tue, 14 Jul 2026 16:06:48 +0200 X-ME-IP: 2a01:cb10:785:b00:26fb:aefb:6cd2:db0e From: Christophe JAILLET To: Vignesh Raghavendra , Vinod Koul , Frank Li , Michal Simek Cc: linux-kernel@vger.kernel.org, kernel-janitors@vger.kernel.org, Christophe JAILLET , dmaengine@vger.kernel.org, linux-arm-kernel@lists.infradead.org Subject: [PATCH] dmaengine: Constify struct dma_descriptor_metadata_ops Date: Tue, 14 Jul 2026 16:06:33 +0200 Message-ID: X-Mailer: git-send-email 2.55.0 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" 'struct dma_descriptor_metadata_ops' in not modified in these drivers. Constifying these structures moves some data to a read-only section, so increases overall security, especially when the structure holds some function pointers. On a x86_64, with allmodconfig, as an example: Before: =3D=3D=3D=3D=3D=3D text data bss dec hex filename 120635 21584 64 142283 22bcb drivers/dma/xilinx/xilinx_dma.o After: =3D=3D=3D=3D=3D text data bss dec hex filename 120699 21520 64 142283 22bcb drivers/dma/xilinx/xilinx_dma.o Signed-off-by: Christophe JAILLET Reviewed-by: Frank Li Reviewed-by: Sai Sree Kartheek Adivi --- Compile tested only. --- drivers/dma/ti/k3-udma.c | 2 +- drivers/dma/xilinx/xilinx_dma.c | 2 +- include/linux/dmaengine.h | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/drivers/dma/ti/k3-udma.c b/drivers/dma/ti/k3-udma.c index 1cf158eb7bdb..fb21e0df5ab7 100644 --- a/drivers/dma/ti/k3-udma.c +++ b/drivers/dma/ti/k3-udma.c @@ -3408,7 +3408,7 @@ static int udma_set_metadata_len(struct dma_async_tx_= descriptor *desc, return 0; } =20 -static struct dma_descriptor_metadata_ops metadata_ops =3D { +static const struct dma_descriptor_metadata_ops metadata_ops =3D { .attach =3D udma_attach_metadata, .get_ptr =3D udma_get_metadata_ptr, .set_len =3D udma_set_metadata_len, diff --git a/drivers/dma/xilinx/xilinx_dma.c b/drivers/dma/xilinx/xilinx_dm= a.c index 98b41b8f8915..bef2b031dba1 100644 --- a/drivers/dma/xilinx/xilinx_dma.c +++ b/drivers/dma/xilinx/xilinx_dma.c @@ -655,7 +655,7 @@ static void *xilinx_dma_get_metadata_ptr(struct dma_asy= nc_tx_descriptor *tx, return seg->hw.app; } =20 -static struct dma_descriptor_metadata_ops xilinx_dma_metadata_ops =3D { +static const struct dma_descriptor_metadata_ops xilinx_dma_metadata_ops = =3D { .get_ptr =3D xilinx_dma_get_metadata_ptr, }; =20 diff --git a/include/linux/dmaengine.h b/include/linux/dmaengine.h index 6fe46c0c9452..fe33a20abc61 100644 --- a/include/linux/dmaengine.h +++ b/include/linux/dmaengine.h @@ -631,7 +631,7 @@ struct dma_async_tx_descriptor { void *callback_param; struct dmaengine_unmap_data *unmap; enum dma_desc_metadata_mode desc_metadata_mode; - struct dma_descriptor_metadata_ops *metadata_ops; + const struct dma_descriptor_metadata_ops *metadata_ops; #ifdef CONFIG_ASYNC_TX_ENABLE_CHANNEL_SWITCH struct dma_async_tx_descriptor *next; struct dma_async_tx_descriptor *parent; --=20 2.55.0