libproc-ng & ps: fix warning reported by smatch
proc/ksym.c +279 read_file(54) info: redundant null check on buf calling free() proc/ksym.c +330 parse_ksyms(41) info: redundant null check on ksyms_data calling free() proc/ksym.c +332 parse_ksyms(43) info: redundant null check on ksyms_index calling free() proc/ksym.c +451 sysmap_mmap(110) info: redundant null check on sysmap_index calling free() proc/procps.h:74:5: warning: undefined preprocessor identifier 'SHARED' proc/slab.c +145 parse_slabinfo20(24) error: potential null derefence 'prev'. proc/slab.c +222 parse_slabinfo11(21) error: potential null derefence 'prev'. ps/stacktrace.c +131 debug(6) error: snprintf() is printing too much 99 vs 16 Signed-off-by: Sami Kerola <kerolasa@iki.fi>
This commit is contained in:
@ -141,7 +141,8 @@ static int parse_slabinfo20(struct slab_info **list, struct slab_stat *stats,
|
||||
if (entries++ == 0)
|
||||
*list = curr;
|
||||
else
|
||||
prev->next = curr;
|
||||
if (prev)
|
||||
prev->next = curr;
|
||||
|
||||
assigned = sscanf(buffer, "%" STRINGIFY(SLAB_INFO_NAME_LEN)
|
||||
"s %d %d %d %d %d : tunables %*d %*d %*d : \
|
||||
@ -218,7 +219,8 @@ static int parse_slabinfo11(struct slab_info **list, struct slab_stat *stats,
|
||||
if (entries++ == 0)
|
||||
*list = curr;
|
||||
else
|
||||
prev->next = curr;
|
||||
if (prev)
|
||||
prev->next = curr;
|
||||
|
||||
assigned = sscanf(buffer, "%" STRINGIFY(SLAB_INFO_NAME_LEN)
|
||||
"s %d %d %d %d %d %d",
|
||||
|
Reference in New Issue
Block a user