monitor: Call mon_get_cpu() only once athmp_gva2gpa()
diff mbox series

Message ID 20190510185620.15757-1-ehabkost@redhat.com
State New
Headers show
Series
  • monitor: Call mon_get_cpu() only once athmp_gva2gpa()
Related show

Commit Message

Eduardo Habkost May 10, 2019, 6:56 p.m. UTC
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).

Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>
---
 monitor.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

Comments

Richard Henderson May 10, 2019, 7:15 p.m. UTC | #1
On 5/10/19 11:56 AM, Eduardo Habkost 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).
> 
> Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>
> ---
>  monitor.c | 3 +--
>  1 file changed, 1 insertion(+), 2 deletions(-)

Reviewed-by: Richard Henderson <richard.henderson@linaro.org>

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


r~
Dr. David Alan Gilbert May 10, 2019, 7:16 p.m. UTC | #2
* Richard Henderson (richard.henderson@linaro.org) wrote:
> On 5/10/19 11:56 AM, Eduardo Habkost 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).
> > 
> > Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>
> > ---
> >  monitor.c | 3 +--
> >  1 file changed, 1 insertion(+), 2 deletions(-)
> 
> Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
> 
> I was about to send the same patch.  ;-)

I did :-)

Reviewed-by: Dr. David Alan Gilbert <dgilbert@redhat.com>

> 
> 
> r~
> 
--
Dr. David Alan Gilbert / dgilbert@redhat.com / Manchester, UK
Dr. David Alan Gilbert May 14, 2019, 5:13 p.m. UTC | #3
* Eduardo Habkost (ehabkost@redhat.com) 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).
> 
> Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>

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

Queued.

> ---
>  monitor.c | 3 +--
>  1 file changed, 1 insertion(+), 2 deletions(-)
> 
> diff --git a/monitor.c b/monitor.c
> index bb48997913..6428eb3b7e 100644
> --- a/monitor.c
> +++ b/monitor.c
> @@ -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 {
> -- 
> 2.18.0.rc1.1.g3f1ff2140
> 
--
Dr. David Alan Gilbert / dgilbert@redhat.com / Manchester, UK

Patch
diff mbox series

diff --git a/monitor.c b/monitor.c
index bb48997913..6428eb3b7e 100644
--- a/monitor.c
+++ b/monitor.c
@@ -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 {