Whamcloud - gitweb
LU-16518 lnet: fix clang build errors 18/50318/3
authorTimothy Day <timday@amazon.com>
Tue, 28 Feb 2023 18:48:04 +0000 (18:48 +0000)
committerOleg Drokin <green@whamcloud.com>
Tue, 11 Apr 2023 20:10:37 +0000 (20:10 +0000)
LNET_PID_ANY and LNET_NID_ANY were defined outside
the range of an u64. They were moved from -1 to the
maximum value for u64.

LNET_NID_ANY was used in an instance where LNET_NET_ANY
should have been used.

Initialize a variable which could potentially be left
uninitialized.

Fixed a minor style issue.

Signed-off-by: Timothy Day <timday@amazon.com>
Change-Id: I61c8b33d98fdaa4b7a4846d0061a483664e4f652
Reviewed-on: https://review.whamcloud.com/c/fs/lustre-release/+/50318
Tested-by: jenkins <devops@whamcloud.com>
Tested-by: Maloo <maloo@whamcloud.com>
Reviewed-by: Neil Brown <neilb@suse.de>
Reviewed-by: Chris Horn <chris.horn@hpe.com>
Reviewed-by: Frank Sehr <fsehr@whamcloud.com>
Reviewed-by: jsimmons <jsimmons@infradead.org>
Reviewed-by: Oleg Drokin <green@whamcloud.com>
lnet/include/uapi/linux/lnet/lnet-types.h
lnet/utils/lnetconfig/cyaml.c
lnet/utils/lnetconfig/liblnetconfig.c

index f515173..780b9b0 100644 (file)
@@ -55,9 +55,9 @@
 #define LNET_RESERVED_PORTAL     0
 
 /** wildcard NID that matches any end-point address */
-#define LNET_NID_ANY     ((lnet_nid_t) -1)
+#define LNET_NID_ANY     (~(lnet_nid_t) 0)
 /** wildcard PID that matches any lnet_pid_t */
-#define LNET_PID_ANY     ((lnet_pid_t) -1)
+#define LNET_PID_ANY     (~(lnet_pid_t) 0)
 
 static inline int LNET_NID_IS_ANY(const struct lnet_nid *nid)
 {
index 7c82645..032bb5a 100644 (file)
@@ -1257,7 +1257,7 @@ void cYAML_build_error(int rc, int seq_no, char *cmd,
                       char *entity, char *err_str,
                       struct cYAML **root)
 {
-       struct cYAML *r = NULL, *err, *s, *itm, *cmd_obj;
+       struct cYAML *r = NULL, *err, *s, *itm = NULL, *cmd_obj;
        if (root == NULL)
                return;
 
@@ -1277,8 +1277,9 @@ void cYAML_build_error(int rc, int seq_no, char *cmd,
        else if (cmd_obj == NULL) {
                s = cYAML_create_seq(r, cmd);
                itm = cYAML_create_seq_item(s);
-       } else if (cmd_obj != NULL && cmd_obj->cy_type != CYAML_TYPE_ARRAY)
+       } else if (cmd_obj != NULL && cmd_obj->cy_type != CYAML_TYPE_ARRAY) {
                goto failed;
+       }
 
        err = cYAML_create_object(itm, entity);
        if (err == NULL)
index 967af40..ec326ef 100644 (file)
@@ -4644,7 +4644,7 @@ static int handle_yaml_config_ip2nets(struct cYAML *tree,
 
        /* assign the network id */
        ip2nets.ip2nets_net.nw_id = libcfs_str2net(net->cy_valuestring);
-       if (ip2nets.ip2nets_net.nw_id == LNET_NID_ANY)
+       if (ip2nets.ip2nets_net.nw_id == LNET_NET_ANY)
                return LUSTRE_CFG_RC_BAD_PARAM;
 
        seq_no = cYAML_get_object_item(tree, "seq_no");