[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20241023131248.27192-5-przemyslaw.kitszel@intel.com>
Date: Wed, 23 Oct 2024 15:09:04 +0200
From: Przemek Kitszel <przemyslaw.kitszel@...el.com>
To: netdev@...r.kernel.org
Cc: Tony Nguyen <anthony.l.nguyen@...el.com>,
nex.sw.ncis.osdt.itp.upstreaming@...el.com,
Marcin Szycik <marcin.szycik@...ux.intel.com>,
Jiri Pirko <jiri@...nulli.us>,
davem@...emloft.net,
Eric Dumazet <edumazet@...gle.com>,
Jakub Kicinski <kuba@...nel.org>,
Paolo Abeni <pabeni@...hat.com>,
Andrew Lunn <andrew@...n.ch>,
Florian Fainelli <f.fainelli@...il.com>,
Vladimir Oltean <olteanv@...il.com>,
linux-kernel@...r.kernel.org,
Przemek Kitszel <przemyslaw.kitszel@...el.com>,
Wojciech Drewek <wojciech.drewek@...el.com>,
Jiri Pirko <jiri@...dia.com>,
Joe Damato <jdamato@...tly.com>
Subject: [PATCH net-next v2 4/7] devlink: region: snapshot IDs: consolidate error values
Consolidate error codes for too big message size.
Current code is written to return -EINVAL when tailroom in the skb msg
would be exhausted precisely when it's time to nest, and return -EMSGSIZE
in all other "not enough space" conditions.
Reviewed-by: Wojciech Drewek <wojciech.drewek@...el.com>
Reviewed-by: Jiri Pirko <jiri@...dia.com>
Reviewed-by: Joe Damato <jdamato@...tly.com>
Signed-off-by: Przemek Kitszel <przemyslaw.kitszel@...el.com>
---
net/devlink/region.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/net/devlink/region.c b/net/devlink/region.c
index 0a75a2fbd4d7..63fb297f6d67 100644
--- a/net/devlink/region.c
+++ b/net/devlink/region.c
@@ -77,7 +77,7 @@ static int devlink_nl_region_snapshot_id_put(struct sk_buff *msg,
snap_attr = nla_nest_start_noflag(msg, DEVLINK_ATTR_REGION_SNAPSHOT);
if (!snap_attr)
- return -EINVAL;
+ return -EMSGSIZE;
err = nla_put_u32(msg, DEVLINK_ATTR_REGION_SNAPSHOT_ID, snapshot->id);
if (err)
@@ -102,7 +102,7 @@ static int devlink_nl_region_snapshots_id_put(struct sk_buff *msg,
snapshots_attr = nla_nest_start_noflag(msg,
DEVLINK_ATTR_REGION_SNAPSHOTS);
if (!snapshots_attr)
- return -EINVAL;
+ return -EMSGSIZE;
list_for_each_entry(snapshot, ®ion->snapshot_list, list) {
err = devlink_nl_region_snapshot_id_put(msg, devlink, snapshot);
--
2.46.0
Powered by blists - more mailing lists