Message ID | 20190610113950.29538-1-colin.king@canonical.com |
---|---|
State | Accepted |
Headers | show |
Series | lib: fwts_log_scan: ensure accumulated error count is initialized | expand |
On 2019-06-10 4:39 a.m., Colin King wrote: > From: Colin Ian King <colin.king@canonical.com> > > Just in case the caller has not initialized the error count, set it > to zero. > > Addresses-Coverity: ("Uninitialized scalar variable") > Signed-off-by: Colin Ian King <colin.king@canonical.com> > --- > src/lib/src/fwts_log_scan.c | 2 ++ > 1 file changed, 2 insertions(+) > > diff --git a/src/lib/src/fwts_log_scan.c b/src/lib/src/fwts_log_scan.c > index 140e8761..c1d15d9c 100644 > --- a/src/lib/src/fwts_log_scan.c > +++ b/src/lib/src/fwts_log_scan.c > @@ -365,6 +365,8 @@ int fwts_log_check(fwts_framework *fw, > json_object *log_table; > fwts_log_pattern *patterns; > > + *errors = 0; > + > /* > * json_object_from_file() can fail when files aren't readable > * so check if we can open for read before calling json_object_from_file() > Acked-by: Alex Hung <alex.hung@canonical.com>
On 6/10/19 7:39 PM, Colin King wrote: > From: Colin Ian King <colin.king@canonical.com> > > Just in case the caller has not initialized the error count, set it > to zero. > > Addresses-Coverity: ("Uninitialized scalar variable") > Signed-off-by: Colin Ian King <colin.king@canonical.com> > --- > src/lib/src/fwts_log_scan.c | 2 ++ > 1 file changed, 2 insertions(+) > > diff --git a/src/lib/src/fwts_log_scan.c b/src/lib/src/fwts_log_scan.c > index 140e8761..c1d15d9c 100644 > --- a/src/lib/src/fwts_log_scan.c > +++ b/src/lib/src/fwts_log_scan.c > @@ -365,6 +365,8 @@ int fwts_log_check(fwts_framework *fw, > json_object *log_table; > fwts_log_pattern *patterns; > > + *errors = 0; > + > /* > * json_object_from_file() can fail when files aren't readable > * so check if we can open for read before calling json_object_from_file() Acked-by: Ivan Hu <ivan.hu@canonical.com>
diff --git a/src/lib/src/fwts_log_scan.c b/src/lib/src/fwts_log_scan.c index 140e8761..c1d15d9c 100644 --- a/src/lib/src/fwts_log_scan.c +++ b/src/lib/src/fwts_log_scan.c @@ -365,6 +365,8 @@ int fwts_log_check(fwts_framework *fw, json_object *log_table; fwts_log_pattern *patterns; + *errors = 0; + /* * json_object_from_file() can fail when files aren't readable * so check if we can open for read before calling json_object_from_file()