From mboxrd@z Thu Jan 1 00:00:00 1970 From: David Vrabel Subject: Re: [PATCH 3/4] xen/events: initialize local per-cpu mask for all possible events Date: Mon, 19 Aug 2013 18:10:38 +0100 Message-ID: <5212518E.5040001@citrix.com> References: <1376569267-11653-1-git-send-email-david.vrabel@citrix.com> <1376569267-11653-4-git-send-email-david.vrabel@citrix.com> <520CE95502000078000EC2FA@nat28.tlf.novell.com> <520CCE71.2050808@citrix.com> <520CEE7102000078000EC336@nat28.tlf.novell.com> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: In-Reply-To: <520CEE7102000078000EC336@nat28.tlf.novell.com> List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xen.org Errors-To: xen-devel-bounces@lists.xen.org To: Jan Beulich Cc: Boris Ostrovsky , xen-devel@lists.xen.org List-Id: xen-devel@lists.xenproject.org On 15/08/13 14:06, Jan Beulich wrote: >>>> On 15.08.13 at 14:49, David Vrabel wrote: >> On 15/08/13 13:44, Jan Beulich wrote: >>>>>> On 15.08.13 at 14:21, David Vrabel 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. Normally I would agree, but in this case a) but this array won't change its size and b) someone was already confused by the original code and copied it across incorrectly. David