From: James Simmons Date: Tue, 8 Nov 2022 14:24:45 +0000 (-0500) Subject: LU-10003 lnet: to properly handle errors reported use ssize_t X-Git-Tag: 2.15.53~83 X-Git-Url: https://git.whamcloud.com/?a=commitdiff_plain;h=refs%2Fchanges%2F68%2F49068%2F2;p=fs%2Flustre-release.git LU-10003 lnet: to properly handle errors reported use ssize_t The function nla_strscpy() can return a negative error value. Replace using size_t with ssize_t to handle potential error states. Test-Parameters: trivial Fixes: 8f8f6e2f3 ("LU-10003 lnet: use Netlink to support old and new NI APIs.") Change-Id: I079f93e3e1005a1062a3fe0807cf8b877712d818 Signed-off-by: James Simmons Reviewed-on: https://review.whamcloud.com/c/fs/lustre-release/+/49068 Tested-by: jenkins Tested-by: Maloo Reviewed-by: Frank Sehr Reviewed-by: Neil Brown Reviewed-by: Andreas Dilger Reviewed-by: Oleg Drokin --- diff --git a/lnet/lnet/api-ni.c b/lnet/lnet/api-ni.c index 970bfed..637a9f6 100644 --- a/lnet/lnet/api-ni.c +++ b/lnet/lnet/api-ni.c @@ -5181,7 +5181,7 @@ static int lnet_net_cmd(struct sk_buff *skb, struct genl_info *info) nla_for_each_nested(entry, attr, rem2) { switch (nla_type(entry)) { case LN_SCALAR_ATTR_VALUE: { - size_t len; + ssize_t len; memset(&conf, 0, sizeof(conf)); if (nla_strcmp(entry, "ip2net") == 0) {