aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTuukka Tikkanen <tuukka.tikkanen@linaro.org>2015-01-13 20:39:33 +0200
committerTuukka Tikkanen <tuukka.tikkanen@linaro.org>2015-01-13 20:39:33 +0200
commit9477d3598858225dfac6e1981060c8f8d078af84 (patch)
tree53be92e9ad4dcf26b78f8197f106e573721aedef
parent514c7c7ebd636a28c00f745fcd10142cbb369fc0 (diff)
Idlestat: Suppress static analysis false positives
The report_ops and trace_ops arrays are created by the linker. Static analysis tool has no idea of this and make a false positive detection for the loops that access the arrays. This patch introduces comments that suppress the detection for the lines in question. Signed-off-by: Tuukka Tikkanen <tuukka.tikkanen@linaro.org>
-rw-r--r--idlestat.c8
-rw-r--r--reports.c8
2 files changed, 16 insertions, 0 deletions
diff --git a/idlestat.c b/idlestat.c
index 39998c3..4392920 100644
--- a/idlestat.c
+++ b/idlestat.c
@@ -900,6 +900,14 @@ struct cpuidle_datas *idlestat_load(const char *filename)
const struct trace_ops **ops_it;
int ret;
+ /*
+ * The linker places pointers to all entries declared with
+ * EXPORT_TRACE_OPS into a special segment. This creates
+ * an array of pointers preceded by trace_ops_head. Let
+ * the static analysis tool know that we know what we are
+ * doing.
+ */
+ /* coverity[array_vs_singleton] */
for (ops_it = (&trace_ops_head)+1 ; *ops_it ; ++ops_it) {
assert((*ops_it)->name);
assert((*ops_it)->check_magic);
diff --git a/reports.c b/reports.c
index 7784cd6..5140b5b 100644
--- a/reports.c
+++ b/reports.c
@@ -34,6 +34,14 @@ void list_report_formats_to_stderr(void)
{
const struct report_ops **ops_it;
+ /*
+ * The linker places pointers to all entries declared with
+ * EXPORT_REPORT_OPS into a special segment. This creates
+ * an array of pointers preceded by report_ops_head. Let
+ * the static analysis tool know that we know what we are
+ * doing.
+ */
+ /* coverity[array_vs_singleton] */
for (ops_it = (&report_ops_head)+1 ; *ops_it ; ++ops_it)
fprintf(stderr, " %s", (*ops_it)->name);