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

Re: [Xen-devel] [PATCH 3/4] xen/events: initialize local per-cpu mask for all possible events



>>> On 15.08.13 at 14:49, David Vrabel <david.vrabel@xxxxxxxxxx> wrote:
> On 15/08/13 13:44, Jan Beulich wrote:
>>>>> On 15.08.13 at 14:21, David Vrabel <david.vrabel@xxxxxxxxxx> wrote:
>>> --- a/drivers/xen/events.c
>>> +++ b/drivers/xen/events.c
>>> @@ -348,7 +348,7 @@ static void init_evtchn_cpu_bindings(void)
>>>  
>>>     for_each_possible_cpu(i)
>>>             memset(per_cpu(cpu_evtchn_mask, i),
>>> -                  (i == 0) ? ~0 : 0, sizeof(*per_cpu(cpu_evtchn_mask, i)));
>>> +                  (i == 0) ? ~0 : 0, NR_EVENT_CHANNELS/8);
>> 
>> I think simply dropping the bogus * would have been the better fix.
> 
> I disagree.  Using NR_EVENT_CHANNELS/8 makes it clearer that this is
> initializing all bits.

My preference of using sizeof() wherever possible is mainly attributed
to the fact that if someone changes the array size, (s)he'd have to go
through and identify and change all the corresponding loop or
whatever boundaries.

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®.