diff mbox

[4/4] x86/kvm: Resolve shadow warning from min macro

Message ID 1406294825-21393-4-git-send-email-jeffrey.t.kirsher@intel.com (mailing list archive)
State New, archived
Headers show

Commit Message

Kirsher, Jeffrey T July 25, 2014, 1:27 p.m. UTC
From: Mark Rustad <mark.d.rustad@intel.com>

Resolve a shadow warning generated in W=2 builds by the nested
use of the min macro by instead using the min3 macro for the
minimum of 3 values.

Signed-off-by: Mark Rustad <mark.d.rustad@intel.com>
Signed-off-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
---
 arch/x86/kvm/emulate.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

Comments

Paolo Bonzini July 25, 2014, 2:06 p.m. UTC | #1
Il 25/07/2014 15:27, Jeff Kirsher ha scritto:
> From: Mark Rustad <mark.d.rustad@intel.com>
> 
> Resolve a shadow warning generated in W=2 builds by the nested
> use of the min macro by instead using the min3 macro for the
> minimum of 3 values.
> 
> Signed-off-by: Mark Rustad <mark.d.rustad@intel.com>
> Signed-off-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
> ---
>  arch/x86/kvm/emulate.c | 3 +--
>  1 file changed, 1 insertion(+), 2 deletions(-)
> 
> diff --git a/arch/x86/kvm/emulate.c b/arch/x86/kvm/emulate.c
> index e4e833d..2d6c97a 100644
> --- a/arch/x86/kvm/emulate.c
> +++ b/arch/x86/kvm/emulate.c
> @@ -1315,8 +1315,7 @@ static int pio_in_emulated(struct x86_emulate_ctxt *ctxt,
>  		in_page = (ctxt->eflags & EFLG_DF) ?
>  			offset_in_page(reg_read(ctxt, VCPU_REGS_RDI)) :
>  			PAGE_SIZE - offset_in_page(reg_read(ctxt, VCPU_REGS_RDI));
> -		n = min(min(in_page, (unsigned int)sizeof(rc->data)) / size,
> -			count);
> +		n = min3(in_page, (unsigned int)sizeof(rc->data) / size, count);
>  		if (n == 0)
>  			n = 1;
>  		rc->pos = rc->end = 0;
> 

Applied.

Paolo
--
To unsubscribe from this list: send the line "unsubscribe kvm" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
diff mbox

Patch

diff --git a/arch/x86/kvm/emulate.c b/arch/x86/kvm/emulate.c
index e4e833d..2d6c97a 100644
--- a/arch/x86/kvm/emulate.c
+++ b/arch/x86/kvm/emulate.c
@@ -1315,8 +1315,7 @@  static int pio_in_emulated(struct x86_emulate_ctxt *ctxt,
 		in_page = (ctxt->eflags & EFLG_DF) ?
 			offset_in_page(reg_read(ctxt, VCPU_REGS_RDI)) :
 			PAGE_SIZE - offset_in_page(reg_read(ctxt, VCPU_REGS_RDI));
-		n = min(min(in_page, (unsigned int)sizeof(rc->data)) / size,
-			count);
+		n = min3(in_page, (unsigned int)sizeof(rc->data) / size, count);
 		if (n == 0)
 			n = 1;
 		rc->pos = rc->end = 0;