[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Xen-devel] [PATCH v2] psr: fix bug which may cause crash



On 28.11.2019 11:18, Yi Sun wrote:
> --- a/xen/arch/x86/psr.c
> +++ b/xen/arch/x86/psr.c
> @@ -1271,7 +1271,8 @@ static void do_write_psr_msrs(void *data)
>  
>          for ( j = 0; j < cos_num; j++, index++ )
>          {
> -            if ( feat->cos_reg_val[cos * cos_num + j] != info->val[index] )
> +            if ( cos <= feat->cos_max &&
> +                 feat->cos_reg_val[cos * cos_num + j] != info->val[index] )

The description is indeed much better now, thanks. However,
as indicated in reply to v1, this extra (and at the first glance
unmotivated) bounds check wants to be accompanied by a brief but
precise comment. Furthermore with the loop bounded by a local
variable, why not

        cos_num = min(props->cos_num, feat->cos_max + 1);

a few lines up from here (again suitable commented)?

Jan

_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxxxxxxxxx
https://lists.xenproject.org/mailman/listinfo/xen-devel

 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.