staging/lustre/libcfs: fix issues found by Klocwork Insight tool
authorDmitry Eremin <dmitry.eremin@intel.com>
Sun, 27 Apr 2014 17:06:55 +0000 (13:06 -0400)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Sun, 27 Apr 2014 17:27:12 +0000 (10:27 -0700)
sscanf format specification '%u' expects type 'unsigned int *'
for 'u', but parameter 3 has a different type 'int*'.

Signed-off-by: Dmitry Eremin <dmitry.eremin@intel.com>
Reviewed-on: http://review.whamcloud.com/9400
Intel-bug-id: https://jira.hpdd.intel.com/browse/LU-4629
Reviewed-by: John L. Hammond <john.hammond@intel.com>
Reviewed-by: James Simmons <uja.ornl@gmail.com>
Signed-off-by: Oleg Drokin <oleg.drokin@intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/staging/lustre/lustre/libcfs/linux/linux-cpu.c
drivers/staging/lustre/lustre/libcfs/nidstrings.c

index 77b1ef64ecc0c340a1132c35faef72e92398a5fe..d169374eb98dd0504ddb0662930d8a177241335e 100644 (file)
@@ -881,7 +881,7 @@ cfs_cpt_table_create_pattern(char *pattern)
                        break;
                }
 
-               if (sscanf(str, "%u%n", &cpt, &n) < 1) {
+               if (sscanf(str, "%d%n", &cpt, &n) < 1) {
                        CERROR("Invalid cpu pattern %s\n", str);
                        goto failed;
                }
index cfb274fc9cbdf0b98548b56130502201b3e7e779..87705ae4480f256cf984e47577e628ffba738fba 100644 (file)
@@ -227,11 +227,11 @@ libcfs_ip_addr2str(__u32 addr, char *str)
 int
 libcfs_ip_str2addr(const char *str, int nob, __u32 *addr)
 {
-       int   a;
-       int   b;
-       int   c;
-       int   d;
-       int   n = nob;                    /* XscanfX */
+       unsigned int    a;
+       unsigned int    b;
+       unsigned int    c;
+       unsigned int    d;
+       int             n = nob; /* XscanfX */
 
        /* numeric IP? */
        if (sscanf(str, "%u.%u.%u.%u%n", &a, &b, &c, &d, &n) >= 4 &&
@@ -419,7 +419,7 @@ libcfs_str2net_internal(const char *str, __u32 *net)
 {
        struct netstrfns *uninitialized_var(nf);
        int            nob;
-       int            netnum;
+       unsigned int   netnum;
        int            i;
 
        for (i = 0; i < libcfs_nnetstrfns; i++) {