master - reporter: simplify --configreport handling for -S|--select and fix an issue reported by coverity
Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=1b11f09d2a3bd3f6421776a004e62215054fa835 Commit: 1b11f09d2a3bd3f6421776a004e62215054fa835 Parent: f0768f636edb8da08e46b029380779fd623399de Author: Peter Rajnoha <[email protected]> AuthorDate: Mon Jun 27 10:14:17 2016 +0200 Committer: Alasdair G Kergon <[email protected]> CommitterDate: Tue Jun 28 02:27:19 2016 +0100
reporter: simplify --configreport handling for -S|--select and fix an issue reported by coverity
Simplify code around _do_get_report_selection - remove "expected_idxs[]" argument which is superfluous and add "allow_single" switch instead to allow for recognition of "--configreport <report_name> -S" as well as single "-S" if needed.
Null pointer dereferences (FORWARD_NULL) /safe/guest2/covscan/LVM2.2.02.158/tools/reporter.c: 961 in _do_report_get_selection() Null pointer dereferences (FORWARD_NULL) Dereferencing null pointer "single_args".
--- lib/report/report.h | 2 +- tools/reporter.c | 60 +++++++++++++++++++++++---------------------------- tools/toollib.c | 2 +- 3 files changed, 29 insertions(+), 35 deletions(-)
lib/report/report.h +1 -1
@@ -90,7 +90,7 @@ void *report_init(struct cmd_context *cmd, const char *format, const char *keys, int aligned, int buffered, int headings, int field_prefixes, int quoted, int columns_as_rows, const char *selection, int multiple_output); -int report_get_single_selection (struct cmd_context *cmd,const char **selection); +int report_get_single_selection (struct cmd_context *cmd,report_type_t report_type,const char **selection);void *report_init_for_selection (struct cmd_context *cmd,report_type_t *report_type,const char *selection); int report_get_prefix_and_desc(report_type_t report_type_id,
tools/reporter.c +27 -33
142 lines not on this page · raw message
tools/toollib.c +1 -1
@@ -1771,7 +1771,7 @@ int init_selection_handle(struct cmd_context *cmd, struct processing_handle *hanreturn 0 ; } -if (!report_get_single_selection (cmd, &selection)) +if (!report_get_single_selection (cmd, initial_report_type, &selection)) return_0; sh->report_type = initial_report_type;