Skip to contentSkip to conversation

monitor: Fix gva2gpa coverityism

PATCH In review Dr. David Alan Gilbert (git) 2 participants 2 messages May 10, 2019 – May 15, 2019

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 monitor: Fix gva2gpa coverityism

From: "Dr. David Alan Gilbert" <[email protected]>

Coverity is complaining that while I'm checking the return value of mon_get_cpu(), I'm not actually using the checked value, I'm calling it again and thus it's worried I might get null; I don't think that's actually possible since i'm under lock anyway.
However, it's a sensible cleanup.

CID: 1401346

---
 monitor.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
monitor.c +1 -1
index bb48997913..f93c4b5c76 100644
@@ -1685,7 +1685,7 @@ static void hmp_gva2gpa(Monitor *mon, const QDict *qdict)
         return;
     }
 
-    gpa  = cpu_get_phys_page_attrs_debug(mon_get_cpu(),
+    gpa  = cpu_get_phys_page_attrs_debug(cs,
                                          addr & TARGET_PAGE_MASK, &attrs);
     if (gpa == -1) {
         monitor_printf(mon, "Unmapped\n");
Signature · 1 line
2.21.0
Reviewed-by on v1 1/1
#1 lore raw
Quoted 9 lines · Dr. David Alan Gilbert (git)

From: "Dr. David Alan Gilbert" <[email protected]>

Coverity is complaining that while I'm checking the return value of mon_get_cpu(), I'm not actually using the checked value, I'm calling it again and thus it's worried I might get null; I don't think that's actually possible since i'm under lock anyway.
However, it's a sensible cleanup.

Quoted 6 lines

CID: 1401346

---
 monitor.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)