]> git.karo-electronics.de Git - linux-beck.git/commitdiff
staging: lustre: libcfs: Make char * array envp static constant
authorJames Simmons <jsimmons@infradead.org>
Thu, 17 Nov 2016 19:35:53 +0000 (14:35 -0500)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Fri, 18 Nov 2016 07:47:32 +0000 (08:47 +0100)
The envp char array can be made static constant.

Signed-off-by: James Simmons <jsimmons@infradead.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/staging/lustre/lnet/libcfs/linux/linux-debug.c

index 8d379389fa8110e9a11485bd7c842e9d9abf368c..d8a98947d208b84e0584da9c55771a06476ed4f3 100644 (file)
@@ -69,10 +69,11 @@ void libcfs_run_debug_log_upcall(char *file)
 {
        char *argv[3];
        int rc;
-       char *envp[] = {
+       static const char * const envp[] = {
                "HOME=/",
                "PATH=/sbin:/bin:/usr/sbin:/usr/bin",
-               NULL};
+               NULL
+       };
 
        argv[0] = lnet_debug_log_upcall;
 
@@ -81,7 +82,7 @@ void libcfs_run_debug_log_upcall(char *file)
 
        argv[2] = NULL;
 
-       rc = call_usermodehelper(argv[0], argv, envp, 1);
+       rc = call_usermodehelper(argv[0], argv, (char **)envp, 1);
        if (rc < 0 && rc != -ENOENT) {
                CERROR("Error %d invoking LNET debug log upcall %s %s; check /sys/kernel/debug/lnet/debug_log_upcall\n",
                       rc, argv[0], argv[1]);
@@ -95,10 +96,11 @@ void libcfs_run_upcall(char **argv)
 {
        int rc;
        int argc;
-       char *envp[] = {
+       static const char * const envp[] = {
                "HOME=/",
                "PATH=/sbin:/bin:/usr/sbin:/usr/bin",
-               NULL};
+               NULL
+       };
 
        argv[0] = lnet_upcall;
        argc = 1;
@@ -107,7 +109,7 @@ void libcfs_run_upcall(char **argv)
 
        LASSERT(argc >= 2);
 
-       rc = call_usermodehelper(argv[0], argv, envp, 1);
+       rc = call_usermodehelper(argv[0], argv, (char **)envp, 1);
        if (rc < 0 && rc != -ENOENT) {
                CERROR("Error %d invoking LNET upcall %s %s%s%s%s%s%s%s%s; check /sys/kernel/debug/lnet/upcall\n",
                       rc, argv[0], argv[1],