staging/lustre/libcfs: fix issues found by Klocwork Insight tool

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>
This commit is contained in:
Dmitry Eremin 2014-04-27 13:06:55 -04:00 committed by Greg Kroah-Hartman
parent ba0e1b5372
commit 16e9f6d48b
2 changed files with 7 additions and 7 deletions

View file

@ -881,7 +881,7 @@ cfs_cpt_table_create_pattern(char *pattern)
break; break;
} }
if (sscanf(str, "%u%n", &cpt, &n) < 1) { if (sscanf(str, "%d%n", &cpt, &n) < 1) {
CERROR("Invalid cpu pattern %s\n", str); CERROR("Invalid cpu pattern %s\n", str);
goto failed; goto failed;
} }

View file

@ -227,11 +227,11 @@ libcfs_ip_addr2str(__u32 addr, char *str)
int int
libcfs_ip_str2addr(const char *str, int nob, __u32 *addr) libcfs_ip_str2addr(const char *str, int nob, __u32 *addr)
{ {
int a; unsigned int a;
int b; unsigned int b;
int c; unsigned int c;
int d; unsigned int d;
int n = nob; /* XscanfX */ int n = nob; /* XscanfX */
/* numeric IP? */ /* numeric IP? */
if (sscanf(str, "%u.%u.%u.%u%n", &a, &b, &c, &d, &n) >= 4 && 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); struct netstrfns *uninitialized_var(nf);
int nob; int nob;
int netnum; unsigned int netnum;
int i; int i;
for (i = 0; i < libcfs_nnetstrfns; i++) { for (i = 0; i < libcfs_nnetstrfns; i++) {