Received: by 2002:ab2:7903:0:b0:1fb:b500:807b with SMTP id a3csp492003lqj; Sun, 2 Jun 2024 07:53:05 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCW9dm8KL+0KEeJedlcj/4RNsl5u4vScWZmRXQTBNCTvhnp2mG2UBHQMTJfchqrdR2rmgSqIj/XpUE4u56h7TrGliWGtOCU0qpizipFI2g== X-Google-Smtp-Source: AGHT+IHI89lbFPFLJyxB81pfmziS3SCG/4ZEsLQHSF+zyujP9n8TR4W/fxYN9SIQz9mgFgHHWPKa X-Received: by 2002:a9d:6d89:0:b0:6f9:18cd:4d78 with SMTP id 46e09a7af769-6f918cd4ebamr5826627a34.3.1717339984685; Sun, 02 Jun 2024 07:53:04 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1717339984; cv=pass; d=google.com; s=arc-20160816; b=yFMCRyZkROKQ8+UhTsDO8PFDDC39v83HHshIESLP0IumyTd9WzebE4hvut2ZVSTnBO L7bBmPh4a8I1ifvYa7CPuS5dohkFqX/OFRXFrp6PvuGpEcHrveS5OuAMt/VjA7BLghkb 1UYCJ2hf6ItFkhjd+MI1bb6W5c8G0k/L4RhB2Bx2BoHALT6SO61FMBdYeuNPkvqbXHj4 rb0nh+Wujm96DRPGgXSkade5m6WD7psj2/RErMyZwLqZ9sSbn+SkmTzhV1BYkTGX7sar 7smu8RTAdrLl0V6ybjUTsAerAH8cxr2cwaIGnBwMiYN9Te2YtCZx1EjMkqtEydwudyyg Jr7Q== 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:references:in-reply-to:message-id :date:subject:cc:to:from:dkim-signature; bh=tSEqEQfth4qJVeha9JEnu00+3Nn6CnfjFpf6x4pdbiI=; fh=8j0eObIb3w6uFvJwSmp4GcBpCygscApxvR1HwJTKo9Y=; b=ky3nznjEmAMRy65oW085YRXYgz8BRNtEMQZzb4NuoJ+x4cXEQDoTR6Zf7jGmHhqX5X ugHmFzqkhO4FQNS75N2paeS5jiVryDdk+j1uYKhdw2IHcg0W5rLBXvAZQDo4122Yirxj TfxMWAm0wenYcn7RxWekqIOa5T0Cq6Bl6OtOTVMrU8RA/yW02+sWTSy0UmAGhkxnPKUb Sidj9N8cQG/00fjvHk30U4S2B1Psc43MmepTirdsA6z1Ql1aBN3ch3qUTxelvBli4HGR 1nGoVNPEHQhZHVJo6w+r+4UdbdoYxoaTfwKpNMJ9G0vMiXdUunkuw0MqQFrcsfAbyUKG 0EXA==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@wanadoo.fr header.s=t20230301 header.b="lW9I/gRQ"; 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-198305-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-198305-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=QUARANTINE sp=NONE dis=NONE) header.from=wanadoo.fr Return-Path: Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [147.75.199.223]) by mx.google.com with ESMTPS id d75a77b69052e-43ff2582339si65212951cf.506.2024.06.02.07.53.04 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 02 Jun 2024 07:53:04 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-198305-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) client-ip=147.75.199.223; Authentication-Results: mx.google.com; dkim=pass header.i=@wanadoo.fr header.s=t20230301 header.b="lW9I/gRQ"; 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-198305-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-198305-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 ny.mirrors.kernel.org (Postfix) with ESMTPS id 626E81C219E8 for ; Sun, 2 Jun 2024 14:53:04 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 30C7443ADC; Sun, 2 Jun 2024 14:52:53 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=wanadoo.fr header.i=@wanadoo.fr header.b="lW9I/gRQ" Received: from smtp.smtpout.orange.fr (smtp-14.smtpout.orange.fr [80.12.242.14]) (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 ADF66B64B; Sun, 2 Jun 2024 14:52:48 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=80.12.242.14 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1717339972; cv=none; b=E71rZ9KklA/0eK0ZgFgW6kG72U+jmTvrpTlvRq06mQGAOzlYBLs7DR+QQ353vTLiwSzs8tCbBZdyot5we3Yf+d+FcAYm52BGrccMik+O2P904pstfukehLR3rCq5nLeLtHZUDjbomGQA6rxSsosM7QcoIKzV4fYv3/Le/0RpK/4= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1717339972; c=relaxed/simple; bh=lTgUwlG7nLBFiETrR69C8cfUl4O8VNEeo7B8BbTo+ZY=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=jcACGcYmf7MmeslE7SgfMd6mUTPosGF8Cv3Xk+G7crLvwr4F+s6bYRhm/BY4MNtkbnTxopW7Z2DEh3GzFkM+pWJpQSqShjn6fYUZ8iHguDNw/1MZSHSLs3WXE5B2ML9sfkFHSXQgUNcmLv5XasIsQT3e/Q8WOSp6pUd3uVdRvx4= 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=lW9I/gRQ; arc=none smtp.client-ip=80.12.242.14 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.17.157]) by smtp.orange.fr with ESMTPA id Dm2ns8x2vLmxrDm2ysLKRD; Sun, 02 Jun 2024 16:18:57 +0200 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=wanadoo.fr; s=t20230301; t=1717337937; bh=tSEqEQfth4qJVeha9JEnu00+3Nn6CnfjFpf6x4pdbiI=; h=From:To:Subject:Date:Message-ID:MIME-Version; b=lW9I/gRQVxMFu1jpMG+o+Dwoe9VaffsG8sUWLrrUW63upI2dFwGHJ/tYt6FUiB+m9 8s0imuKf+JWbw6+l5tt6nsfvVmS6Ohv7qlbie/rBpq40bf1bBuKdKHRjHfnA+x4Unc R6J5WL1Aornl7H+0A5g1D+ixQf+a81Ja/Otzo1vu/3bT9C2AyEXDVIbrZ4OXXGXg+P g0tH9wLO1utXdRoHy46J241KX/IbAp8rylHWQtllfAmWittTbT6XPsjLCZVjtd/4Yd /1O94jiq28JdrVYo+6337fYE7hVb88/2j3AaarUFOmiY88zQ+SaFNwxrRicyjUqdAp pIgjpJzDdxL9Q== X-ME-Helo: fedora.home X-ME-Auth: Y2hyaXN0b3BoZS5qYWlsbGV0QHdhbmFkb28uZnI= X-ME-Date: Sun, 02 Jun 2024 16:18:57 +0200 X-ME-IP: 86.243.17.157 From: Christophe JAILLET To: idosch@nvidia.com, petrm@nvidia.com, davem@davemloft.net, edumazet@google.com, kuba@kernel.org, pabeni@redhat.com, jiri@resnulli.us Cc: netdev@vger.kernel.org, linux-kernel@vger.kernel.org, kernel-janitors@vger.kernel.org, Christophe JAILLET Subject: [PATCH 1/2 net-next] devlink: Constify the 'table_ops' parameter of devl_dpipe_table_register() Date: Sun, 2 Jun 2024 16:18:52 +0200 Message-ID: <3d1deee6bb5a31ee1a41645223fa8b4df1eef7ba.1717337525.git.christophe.jaillet@wanadoo.fr> X-Mailer: git-send-email 2.45.1 In-Reply-To: References: 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 devlink_dpipe_table_ops" only contains some function pointers. Update "struct devlink_dpipe_table" and the 'table_ops' parameter of devl_dpipe_table_register() so that structures in drivers can be constified. Constifying these structures will move some data to a read-only section, so increase overall security. Signed-off-by: Christophe JAILLET --- include/net/devlink.h | 4 ++-- net/devlink/dpipe.c | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/include/net/devlink.h b/include/net/devlink.h index 35eb0f884386..db5eff6cb60f 100644 --- a/include/net/devlink.h +++ b/include/net/devlink.h @@ -352,7 +352,7 @@ struct devlink_dpipe_table { bool resource_valid; u64 resource_id; u64 resource_units; - struct devlink_dpipe_table_ops *table_ops; + const struct devlink_dpipe_table_ops *table_ops; struct rcu_head rcu; }; @@ -1751,7 +1751,7 @@ void devl_sb_unregister(struct devlink *devlink, unsigned int sb_index); void devlink_sb_unregister(struct devlink *devlink, unsigned int sb_index); int devl_dpipe_table_register(struct devlink *devlink, const char *table_name, - struct devlink_dpipe_table_ops *table_ops, + const struct devlink_dpipe_table_ops *table_ops, void *priv, bool counter_control_extern); void devl_dpipe_table_unregister(struct devlink *devlink, const char *table_name); diff --git a/net/devlink/dpipe.c b/net/devlink/dpipe.c index a72a9292efc5..55009b377447 100644 --- a/net/devlink/dpipe.c +++ b/net/devlink/dpipe.c @@ -839,7 +839,7 @@ EXPORT_SYMBOL_GPL(devlink_dpipe_table_counter_enabled); */ int devl_dpipe_table_register(struct devlink *devlink, const char *table_name, - struct devlink_dpipe_table_ops *table_ops, + const struct devlink_dpipe_table_ops *table_ops, void *priv, bool counter_control_extern) { struct devlink_dpipe_table *table; -- 2.45.1