Skip to contentSkip to conversation

target/arm: Suppress Coverity warning for PRF

RFC Applied Richard Henderson 2 participants 3 messages Jul 5, 2018 – Jul 6, 2018

lore
Share & tools
lore
#0 lore raw

RFC 1/1 target/arm: Suppress Coverity warning for PRF

These instructions must perform the sve_access_check, but since they are implemented as NOPs there is no generated code to elide when the access check fails.

Fixes Coverity issues 1393780 & 1393779.

---

Does anyone know if this actually works for Coverity? I'd hate to churn the code without knowing.

---
 target/arm/translate-sve.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
target/arm/translate-sve.c +2 -2
index c080345b9c..d41f1155f9 100644
@@ -5164,7 +5164,7 @@ static bool trans_ST1_zpiz(DisasContext *s, arg_ST1_zpiz *a, uint32_t insn)
 static bool trans_PRF(DisasContext *s, arg_PRF *a, uint32_t insn)
 {
     /* Prefetch is a nop within QEMU.  */
-    sve_access_check(s);
+    (void)sve_access_check(s);
     return true;
 }
 
@@ -5174,7 +5174,7 @@ static bool trans_PRF_rr(DisasContext *s, arg_PRF_rr *a, uint32_t insn)
         return false;
     }
     /* Prefetch is a nop within QEMU.  */
-    sve_access_check(s);
+    (void)sve_access_check(s);
     return true;
 }
 
Signature · 1 line
2.17.1
#1 lore raw
Quoted 10 lines · Richard Henderson

These instructions must perform the sve_access_check, but since they are implemented as NOPs there is no generated code to elide when the access check fails.

Fixes Coverity issues 1393780 & 1393779.

---

Does anyone know if this actually works for Coverity? I'd hate to churn the code without knowing.

Googling suggests that cast-to-void works. I tend to just mark them as false-positive in the Coverity GUI, though...

thanks
-- PMM

#2 lore raw
Quoted 9 lines · Peter Maydell
Quoted 8 lines · Richard Henderson

These instructions must perform the sve_access_check, but since they are implemented as NOPs there is no generated code to elide when the access check fails.

Fixes Coverity issues 1393780 & 1393779.

---

Quoted 5 lines
Quoted 2 lines

Does anyone know if this actually works for Coverity? I'd hate to churn the code without knowing.

Googling suggests that cast-to-void works. I tend to just mark them as false-positive in the Coverity GUI, though...

In this case, since you've written the patch we may as well use it -- it works for human readers too.

Applied to target-arm.next, thanks.

-- PMM