diff mbox

[2/2] kvm tools, vesa: Fix 'ah' access in int10_vesa()

Message ID 1307129824-8396-2-git-send-email-penberg@kernel.org (mailing list archive)
State New, archived
Headers show

Commit Message

Pekka Enberg June 3, 2011, 7:37 p.m. UTC
This patch fixes access to 'ah' in int10_vesa() by masking the high bits.

Cc: Ingo Molnar <mingo@elte.hu>
Cc: Cyrill Gorcunov <gorcunov@gmail.com>
Cc: John Floren <john@jfloren.net>
Cc: Sasha Levin <levinsasha928@gmail.com>
Signed-off-by: Pekka Enberg <penberg@kernel.org>
---
 tools/kvm/bios/int10.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

Comments

Cyrill Gorcunov June 3, 2011, 7:43 p.m. UTC | #1
On Fri, Jun 03, 2011 at 10:37:04PM +0300, Pekka Enberg wrote:
> This patch fixes access to 'ah' in int10_vesa() by masking the high bits.
> 
> Cc: Ingo Molnar <mingo@elte.hu>
> Cc: Cyrill Gorcunov <gorcunov@gmail.com>
> Cc: John Floren <john@jfloren.net>
> Cc: Sasha Levin <levinsasha928@gmail.com>
> Signed-off-by: Pekka Enberg <penberg@kernel.org>
> ---
... 

Ack, thanks Pekka!

   Cyrill
--
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
Avi Kivity June 6, 2011, 8:28 a.m. UTC | #2
On 06/03/2011 10:37 PM, Pekka Enberg wrote:
> This patch fixes access to 'ah' in int10_vesa() by masking the high bits.
>
> @@ -131,7 +131,7 @@ static void int10_vesa(struct int10_args *args)
>   {
>   	u8 al;
>
> -	al = args->eax;
> +	al = args->eax&  0xff;

Isn't this reading %al?  And the high bits are masked by the type of the 
variable?
Cyrill Gorcunov June 6, 2011, 8:37 a.m. UTC | #3
On Mon, Jun 06, 2011 at 11:28:56AM +0300, Avi Kivity wrote:
> On 06/03/2011 10:37 PM, Pekka Enberg wrote:
> >This patch fixes access to 'ah' in int10_vesa() by masking the high bits.
> >
> >@@ -131,7 +131,7 @@ static void int10_vesa(struct int10_args *args)
> >  {
> >  	u8 al;
> >
> >-	al = args->eax;
> >+	al = args->eax&  0xff;
> 
> Isn't this reading %al?  And the high bits are masked by the type of
> the variable?
> 

Type conversion will do the work but having explicit masking is
a way better I believe, at least it makes this code snippet notable.

	Cyrill
--
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
Pekka Enberg June 6, 2011, 9:09 a.m. UTC | #4
On Mon, Jun 6, 2011 at 11:37 AM, Cyrill Gorcunov <gorcunov@gmail.com> wrote:
> On Mon, Jun 06, 2011 at 11:28:56AM +0300, Avi Kivity wrote:
>> On 06/03/2011 10:37 PM, Pekka Enberg wrote:
>> >This patch fixes access to 'ah' in int10_vesa() by masking the high bits.
>> >
>> >@@ -131,7 +131,7 @@ static void int10_vesa(struct int10_args *args)
>> >  {
>> >     u8 al;
>> >
>> >-    al = args->eax;
>> >+    al = args->eax&  0xff;
>>
>> Isn't this reading %al?  And the high bits are masked by the type of
>> the variable?
>>
>
> Type conversion will do the work but having explicit masking is
> a way better I believe, at least it makes this code snippet notable.

True but the patch description is bogus as it really doesn't _fix_ anything.

                        Pekka
--
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
Cyrill Gorcunov June 6, 2011, 9:11 a.m. UTC | #5
On Mon, Jun 06, 2011 at 12:09:25PM +0300, Pekka Enberg wrote:
...
> > Type conversion will do the work but having explicit masking is
> > a way better I believe, at least it makes this code snippet notable.
> 
> True but the patch description is bogus as it really doesn't _fix_ anything.
> 
>                         Pekka

Yup, I somehow missed 'fix' word in log, looked only in patch body, sorry.

	Cyrill
--
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/tools/kvm/bios/int10.c b/tools/kvm/bios/int10.c
index f7fecac..498a93a 100644
--- a/tools/kvm/bios/int10.c
+++ b/tools/kvm/bios/int10.c
@@ -131,7 +131,7 @@  static void int10_vesa(struct int10_args *args)
 {
 	u8 al;
 
-	al = args->eax;
+	al = args->eax & 0xff;
 
 	switch (al) {
 	case 0x00: