On 15/05/17 16:31, Jan Beulich wrote:
>>>> On 15.05.17 at 14:50, <andrew.coop...@citrix.com> wrote:
>> --- a/xen/arch/x86/traps.c
>> +++ b/xen/arch/x86/traps.c
>> @@ -633,9 +633,12 @@ void pv_inject_event(const struct x86_event *event)
>>      const struct trap_info *ti;
>>      const uint8_t vector = event->vector;
>>      const bool use_error_code =
>> +        (event->type == X86_EVENTTYPE_HW_EXCEPTION) &&
>>          ((vector < 32) && (TRAP_HAVE_EC & (1u << vector)));
>>      unsigned int error_code = event->error_code;
>>  
>> +    ASSERT(event->type == X86_EVENTTYPE_HW_EXCEPTION ||
>> +           event->type == X86_EVENTTYPE_SW_INTERRUPT);
> Wouldn't it be better to tighten this even further:
>
>     if ( event->type == X86_EVENTTYPE_HW_EXCEPTION )
>     {
>         ASSERT(vector < 32);
>         use_error_code = TRAP_HAVE_EC & (1u << vector);
>     }
>     else
>     {
>         ASSERT(event->type == X86_EVENTTYPE_SW_INTERRUPT);
>         use_error_code = false;
>     }
>
> ? If you agree
> Reviewed-by: Jan Beulich <jbeul...@suse.com>
> with this or a substantially identical change.

Yeah.  I'm happy with this, and it will have a small knock-on to the
following patch.

~Andrew

_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xen.org
https://lists.xen.org/xen-devel

Reply via email to