Whamcloud - gitweb
LU-11530 lnet: properly error check sensitivity 92/33392/2
authorAmir Shehata <ashehata@whamcloud.com>
Wed, 17 Oct 2018 19:59:13 +0000 (12:59 -0700)
committerOleg Drokin <green@whamcloud.com>
Fri, 2 Nov 2018 07:18:44 +0000 (07:18 +0000)
Reject setting health sensitivity greater than the maximum health
value.

Test-Parameters: trivial
Signed-off-by: Amir Shehata <ashehata@whamcloud.com>
Change-Id: I866ff2cac2ba6b034cdbac24096e7014c66a3e2e
Reviewed-on: https://review.whamcloud.com/33392
Tested-by: Jenkins
Tested-by: Maloo <hpdd-maloo@intel.com>
Reviewed-by: Sonia Sharma <sharmaso@whamcloud.com>
Reviewed-by: Doug Oucharek <dougso@me.com>
Reviewed-by: Oleg Drokin <green@whamcloud.com>
lnet/lnet/api-ni.c

index b2d4c25..d796e9c 100644 (file)
@@ -217,9 +217,11 @@ sensitivity_set(const char *val, cfs_kernel_param_arg_t *kp)
                return 0;
        }
 
                return 0;
        }
 
-       if (value == *sensitivity) {
+       if (value > LNET_MAX_HEALTH_VALUE) {
                mutex_unlock(&the_lnet.ln_api_mutex);
                mutex_unlock(&the_lnet.ln_api_mutex);
-               return 0;
+               CERROR("Invalid health value. Maximum: %d value = %lu\n",
+                      LNET_MAX_HEALTH_VALUE, value);
+               return -EINVAL;
        }
 
        *sensitivity = value;
        }
 
        *sensitivity = value;