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

Re: [Xen-devel] [PATCH v3 07/23] xsplice: Implement support for applying/reverting/replacing patches. (v5)



>>> On 16.02.16 at 20:11, <andrew.cooper3@xxxxxxxxxx> wrote:
> On 12/02/16 18:05, Konrad Rzeszutek Wilk wrote:
>> +void xsplice_revert_jmp(struct xsplice_patch_func *func)
>> +{
>> +    memcpy((void *)func->old_addr, func->undo, PATCH_INSN_SIZE);
> 
> _p() is common shorthand in Xen for a cast to (void *)

Iirc this was meant to be used only in printk() arguments, and may
also only have been needed to abstract out some 32-/64-bit
differences. I'd certainly discourage use here.

>> +static int apply_payload(struct payload *data)
>> +{
>> +    unsigned int i;
>> +
>> +    printk(XENLOG_DEBUG "%s: Applying %u functions.\n", data->name,
>> +           data->nfuncs);
>> +
>> +    for ( i = 0; i < data->nfuncs; i++ )
>> +        xsplice_apply_jmp(data->funcs + i);
> 
> In cases such as this, it is better to use data->funcs[i], as the
> compiler can more easily perform pointer alias analysis.

Why would that be? &x[i] and x + i are identical for all purposes
afaik.

Jan


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


 


Rackspace

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