[PATCH 22/26] leon, l2cache: prevent unused diagnostic access

Daniel Hellstrom daniel at gaisler.com
Mon Jun 29 11:28:09 UTC 2020


From: Martin Aberg <maberg at gaisler.com>

---
 bsps/shared/grlib/l2c/l2c.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/bsps/shared/grlib/l2c/l2c.c b/bsps/shared/grlib/l2c/l2c.c
index ddef0ad..4a443ed 100644
--- a/bsps/shared/grlib/l2c/l2c.c
+++ b/bsps/shared/grlib/l2c/l2c.c
@@ -894,9 +894,9 @@ int l2cache_diag_tag( int way, int index, struct l2cache_tag * tag)
 		return L2CACHE_ERR_EINVAL;
 	}
 
-	unsigned int val = l2cache_reg_diagtag(way,index);
-
 	if (tag){
+		unsigned int val = l2cache_reg_diagtag(way,index);
+
 		tag->tag   = l2cache_get_tag(val);
 		tag->valid = l2cache_tag_valid(val);
 		tag->dirty = l2cache_tag_dirty(val);
-- 
2.7.4



More information about the devel mailing list