From: Przemek Kitszel Date: Wed, 23 Oct 2024 13:09:04 +0000 (+0200) Subject: devlink: region: snapshot IDs: consolidate error values X-Git-Tag: v6.13-rc1~135^2~196^2~3 X-Git-Url: https://git.kernel.dk/?a=commitdiff_plain;h=72429e9e0cfb1bd7480a968d741edf787c134f06;p=linux-block.git 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 Reviewed-by: Jiri Pirko Reviewed-by: Joe Damato Signed-off-by: Przemek Kitszel Link: https://patch.msgid.link/20241023131248.27192-5-przemyslaw.kitszel@intel.com Signed-off-by: Jakub Kicinski --- 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);