[Skiboot] [PATCH 3/8] mem_region.c: Move ifdef for MEM_POISON to shut up static analysis

Stewart Smith stewart at linux.ibm.com
Thu Nov 29 15:28:28 AEDT 2018


The static analysis tool is arguably wrong and should go away.

But... I'm sick of keeping coming back to it and reviewing the false
positives enough to make a slight change to where ifdefs are.

Signed-off-by: Stewart Smith <stewart at linux.ibm.com>
---
 core/mem_region.c | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)

diff --git a/core/mem_region.c b/core/mem_region.c
index 7aac4e1c4f6a..74551922b1be 100644
--- a/core/mem_region.c
+++ b/core/mem_region.c
@@ -162,8 +162,6 @@ static void mem_poison(struct free_hdr *f)
 
 	memset(f+1, POISON_MEM_REGION_WITH, poison_size);
 }
-#else
-static inline void mem_poison(struct free_hdr *f __unused) { }
 #endif
 
 /* Creates free block covering entire region. */
@@ -178,7 +176,9 @@ static void init_allocatable_region(struct mem_region *region)
 	*tailer(f) = f->hdr.num_longs;
 	list_head_init(&region->free_list);
 	list_add(&region->free_list, &f->list);
+#if POISON_MEM_REGION == 1
 	mem_poison(f);
+#endif
 }
 
 static void make_free(struct mem_region *region, struct free_hdr *f,
@@ -186,8 +186,12 @@ static void make_free(struct mem_region *region, struct free_hdr *f,
 {
 	struct alloc_hdr *next;
 
+#if POISON_MEM_REGION == 1
 	if (!skip_poison)
 		mem_poison(f);
+#else
+	(void)skip_poison;
+#endif
 
 	if (f->hdr.prev_free) {
 		struct free_hdr *prev;
-- 
2.19.2



More information about the Skiboot mailing list