Skip to contentSkip to conversation

monitor: Call mon_get_cpu() only once at hmp_gva2gpa()

PATCH In review Eduardo Habkost 3 participants 4 messages May 10, 2019 – May 14, 2019

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 monitor: Call mon_get_cpu() only once at hmp_gva2gpa()

hmp_gva2gpa() calls mon_get_cpu() twice, which is unnecessary. Not an actual bug, but this is reported as a defect by Coverity Scan (CID 1401346).

---
 monitor.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)
monitor.c +1 -2
index bb48997913..6428eb3b7e 100644
@@ -1685,8 +1685,7 @@ static void hmp_gva2gpa(Monitor *mon, const QDict *qdict)
         return;
     }
 
-    gpa  = cpu_get_phys_page_attrs_debug(mon_get_cpu(),
-                                         addr & TARGET_PAGE_MASK, &attrs);
+    gpa  = cpu_get_phys_page_attrs_debug(cs, addr & TARGET_PAGE_MASK, &attrs);
     if (gpa == -1) {
         monitor_printf(mon, "Unmapped\n");
     } else {
Signature · 1 line
2.18.0.rc1.1.g3f1ff2140
#2 lore raw
Quoted 5 lines · * Richard Henderson ([email protected]) wrote:
Quoted 4 lines · Eduardo Habkost

hmp_gva2gpa() calls mon_get_cpu() twice, which is unnecessary. Not an actual bug, but this is reported as a defect by Coverity Scan (CID 1401346).

Quoted 8 lines
Quoted 4 lines
---
 monitor.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

I was about to send the same patch. ;-)

I did :-)

Quoted 4 lines

r~

--
Dr. David Alan Gilbert / [email protected] / Manchester, UK

#3 lore raw
In reply to Eduardo Habkost
Quoted 5 lines · * Eduardo Habkost ([email protected]) wrote:

hmp_gva2gpa() calls mon_get_cpu() twice, which is unnecessary. Not an actual bug, but this is reported as a defect by Coverity Scan (CID 1401346).

I'm going to sneak this onto the end of a migration pull I'm just cooking.

Queued.

Quoted 21 lines
---
 monitor.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)
monitor.c +1 -2
index bb48997913..6428eb3b7e 100644
@@ -1685,8 +1685,7 @@ static void hmp_gva2gpa(Monitor *mon, const QDict *qdict)
         return;
     }
 
-    gpa  = cpu_get_phys_page_attrs_debug(mon_get_cpu(),
-                                         addr & TARGET_PAGE_MASK, &attrs);
+    gpa  = cpu_get_phys_page_attrs_debug(cs, addr & TARGET_PAGE_MASK, &attrs);
     if (gpa == -1) {
         monitor_printf(mon, "Unmapped\n");
     } else {
Signature · 1 line
2.18.0.rc1.1.g3f1ff2140

--
Dr. David Alan Gilbert / [email protected] / Manchester, UK