]> asedeno.scripts.mit.edu Git - linux.git/commitdiff
staging: lustre: remove broken dead code in cfs_cpt_table_create_pattern
authorArnd Bergmann <arnd@arndb.de>
Mon, 17 Oct 2016 22:08:56 +0000 (00:08 +0200)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Tue, 25 Oct 2016 07:52:02 +0000 (09:52 +0200)
After a recent bugfix, we get a warning about the use of an uninitialized
variable:

drivers/staging/lustre/lnet/libcfs/linux/linux-cpu.c: In function 'cfs_cpt_table_create_pattern':
drivers/staging/lustre/lnet/libcfs/linux/linux-cpu.c:833:7: error: 'str' may be used uninitialized in this function [-Werror=maybe-uninitialized]

This part of the function used to not do anything as we would reassign
the 'str' pointer to something else right away, but now we pass an
uninitialized pointer into 'strchr', which can cause a kernel page fault
or worse.

Fixes: 239fd5d41f9b ("staging: lustre: libcfs: shortcut to create CPT from NUMA topology")
Cc: Liang Zhen <liang.zhen@intel.com>
Cc: James Simmons <jsimmons@infradead.org>
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/staging/lustre/lnet/libcfs/linux/linux-cpu.c

index 464b27923ac0891c7c9cd2dd2d13ef30137bdca8..6a31521f6ae0d32c04ac55d1718981f03a51625f 100644 (file)
@@ -829,13 +829,6 @@ cfs_cpt_table_create_pattern(char *pattern)
        int                     c;
        int i;
 
-       for (ncpt = 0;; ncpt++) { /* quick scan bracket */
-               str = strchr(str, '[');
-               if (!str)
-                       break;
-               str++;
-       }
-
        str = cfs_trimwhite(pattern);
        if (*str == 'n' || *str == 'N') {
                pattern = str + 1;