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

Re: [XEN PATCH 1/5] xen/common: address violations of MISRA C:2012 Rule 8.2


  • To: Federico Serafini <federico.serafini@xxxxxxxxxxx>
  • From: Jan Beulich <jbeulich@xxxxxxxx>
  • Date: Thu, 23 Nov 2023 09:59:14 +0100
  • Arc-authentication-results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=suse.com; dmarc=pass action=none header.from=suse.com; dkim=pass header.d=suse.com; arc=none
  • Arc-message-signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=PUwS8YtdcKR3ZozL4x8+P03QzR7X367404VRUQDFq/4=; b=TPRKSol8SXXpoXTBe2sbozkw6ARtPiRekYEEhBOo9q3jOypI+35df79w77rksIF+fBZ0+9Rra0FxZDjOJ5lE/pGqwnPLJp2qu1iuEHF02tvTlATu8DKgP84OkPldJU4vDTMymCJg1N5WRaq3ZjVX0sZGEQWK5CKHWBfDEpQO7S3OWswu6YfPB8Y8j9MXuJulykpNiyZ5kFKCQux5yl9p4U2E8vD8oYUo9fV31D7Yle6R6C4vVGvNvBYYitsPUrVcubeZjsquN4vh8C4Xe/R5tUbStThiTL7m6a/g/hPbqWyvWALMPtKp5YGqJ7ljRflr5/TethlCoa6tHrCg2tbEtw==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=RuuJ5dkGfalmi4/yY3WKYkFM6yh2/tHZCi2eK4uf2C1k5xrWRpqt7l9g9Dn6oMJm+lhignct4jFP5p/z2gkWhPnQOkh0hkuSFKxEgp22jUyNHnJQ9wgABvtsAm+2BAyfw4I8QMNGttoQSbSo7YhAt/wBdV2gSfSZIYfrqzyA1IZVEzwaF2P7ARwTuqPwNXsca6EWrUbgWpxVMvlu4YDX7MDuT3gl+qCB6sfpytm91FtrjeZiViXfUi7Rb/Un325gSXEM+7R73ZJ7r9WhfSZp9AP8/zZ70DzzsoGqS6OBWdmIieTHRw2Dm3UU0eqZnmsufHfwZHwhvpWwklYj4FFDLg==
  • Authentication-results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=suse.com;
  • Autocrypt: addr=jbeulich@xxxxxxxx; keydata= xsDiBFk3nEQRBADAEaSw6zC/EJkiwGPXbWtPxl2xCdSoeepS07jW8UgcHNurfHvUzogEq5xk hu507c3BarVjyWCJOylMNR98Yd8VqD9UfmX0Hb8/BrA+Hl6/DB/eqGptrf4BSRwcZQM32aZK 7Pj2XbGWIUrZrd70x1eAP9QE3P79Y2oLrsCgbZJfEwCgvz9JjGmQqQkRiTVzlZVCJYcyGGsD /0tbFCzD2h20ahe8rC1gbb3K3qk+LpBtvjBu1RY9drYk0NymiGbJWZgab6t1jM7sk2vuf0Py O9Hf9XBmK0uE9IgMaiCpc32XV9oASz6UJebwkX+zF2jG5I1BfnO9g7KlotcA/v5ClMjgo6Gl MDY4HxoSRu3i1cqqSDtVlt+AOVBJBACrZcnHAUSuCXBPy0jOlBhxPqRWv6ND4c9PH1xjQ3NP nxJuMBS8rnNg22uyfAgmBKNLpLgAGVRMZGaGoJObGf72s6TeIqKJo/LtggAS9qAUiuKVnygo 3wjfkS9A3DRO+SpU7JqWdsveeIQyeyEJ/8PTowmSQLakF+3fote9ybzd880fSmFuIEJldWxp Y2ggPGpiZXVsaWNoQHN1c2UuY29tPsJgBBMRAgAgBQJZN5xEAhsDBgsJCAcDAgQVAggDBBYC AwECHgECF4AACgkQoDSui/t3IH4J+wCfQ5jHdEjCRHj23O/5ttg9r9OIruwAn3103WUITZee e7Sbg12UgcQ5lv7SzsFNBFk3nEQQCACCuTjCjFOUdi5Nm244F+78kLghRcin/awv+IrTcIWF hUpSs1Y91iQQ7KItirz5uwCPlwejSJDQJLIS+QtJHaXDXeV6NI0Uef1hP20+y8qydDiVkv6l IreXjTb7DvksRgJNvCkWtYnlS3mYvQ9NzS9PhyALWbXnH6sIJd2O9lKS1Mrfq+y0IXCP10eS FFGg+Av3IQeFatkJAyju0PPthyTqxSI4lZYuJVPknzgaeuJv/2NccrPvmeDg6Coe7ZIeQ8Yj t0ARxu2xytAkkLCel1Lz1WLmwLstV30g80nkgZf/wr+/BXJW/oIvRlonUkxv+IbBM3dX2OV8 AmRv1ySWPTP7AAMFB/9PQK/VtlNUJvg8GXj9ootzrteGfVZVVT4XBJkfwBcpC/XcPzldjv+3 HYudvpdNK3lLujXeA5fLOH+Z/G9WBc5pFVSMocI71I8bT8lIAzreg0WvkWg5V2WZsUMlnDL9 mpwIGFhlbM3gfDMs7MPMu8YQRFVdUvtSpaAs8OFfGQ0ia3LGZcjA6Ik2+xcqscEJzNH+qh8V m5jjp28yZgaqTaRbg3M/+MTbMpicpZuqF4rnB0AQD12/3BNWDR6bmh+EkYSMcEIpQmBM51qM EKYTQGybRCjpnKHGOxG0rfFY1085mBDZCH5Kx0cl0HVJuQKC+dV2ZY5AqjcKwAxpE75MLFkr wkkEGBECAAkFAlk3nEQCGwwACgkQoDSui/t3IH7nnwCfcJWUDUFKdCsBH/E5d+0ZnMQi+G0A nAuWpQkjM1ASeQwSHEeAWPgskBQL
  • Cc: xen-devel@xxxxxxxxxxxxxxxxxxxx, consulting@xxxxxxxxxxx, Andrew Cooper <andrew.cooper3@xxxxxxxxxx>, George Dunlap <george.dunlap@xxxxxxxxxx>, Julien Grall <julien@xxxxxxx>, Wei Liu <wl@xxxxxxx>, Stefano Stabellini <sstabellini@xxxxxxxxxx>
  • Delivery-date: Thu, 23 Nov 2023 08:59:25 +0000
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>

On 21.11.2023 01:02, Stefano Stabellini wrote:
> On Mon, 19 Nov 2023, Federico Serafini wrote:
>> On 18/11/23 03:59, Stefano Stabellini wrote:
>>> On Fri, 17 Nov 2023, Federico Serafini wrote:
>>>> diff --git a/xen/common/stop_machine.c b/xen/common/stop_machine.c
>>>> index 3adbe380de..398cfd507c 100644
>>>> --- a/xen/common/stop_machine.c
>>>> +++ b/xen/common/stop_machine.c
>>>> @@ -46,7 +46,7 @@ struct stopmachine_data {
>>>>         unsigned int fn_cpu;
>>>>       int fn_result;
>>>> -    int (*fn)(void *);
>>>> +    int (*fn)(void *data);
>>>>       void *fn_data;
>>>>   };
>>>
>>> At least one of the possible function used here calls the parameter
>>> "arg", see take_cpu_down. But I don't think it is a MISRA requirement to
>>> also harmonize those?
>>>
>>>
>>>> @@ -73,7 +73,7 @@ static void stopmachine_wait_state(void)
>>>>    * mandatory to be called only on an idle vcpu, as otherwise active core
>>>>    * scheduling might hang.
>>>>    */
>>>> -int stop_machine_run(int (*fn)(void *), void *data, unsigned int cpu)
>>>> +int stop_machine_run(int (*fn)(void *data), void *data, unsigned int cpu)
>>>>   {
>>>>       unsigned int i, nr_cpus;
>>>>       unsigned int this = smp_processor_id();
>>>> diff --git a/xen/common/tasklet.c b/xen/common/tasklet.c
>>>> index 3ad67b5c24..3649798e6b 100644
>>>> --- a/xen/common/tasklet.c
>>>> +++ b/xen/common/tasklet.c
>>>> @@ -199,7 +199,7 @@ static void migrate_tasklets_from_cpu(unsigned int
>>>> cpu, struct list_head *list)
>>>>       spin_unlock_irqrestore(&tasklet_lock, flags);
>>>>   }
>>>>   -void tasklet_init(struct tasklet *t, void (*func)(void *), void *data)
>>>> +void tasklet_init(struct tasklet *t, void (*func)(void *data), void
>>>> *data)
>>>>   {
>>>>       memset(t, 0, sizeof(*t));
>>>>       INIT_LIST_HEAD(&t->list);
>>>> @@ -208,7 +208,8 @@ void tasklet_init(struct tasklet *t, void (*func)(void
>>>> *), void *data)
>>>>       t->data = data;
>>>>   }
>>>>   -void softirq_tasklet_init(struct tasklet *t, void (*func)(void *), void
>>>> *data)
>>>> +void softirq_tasklet_init(struct tasklet *t,
>>>> +                          void (*func)(void *data), void *data)
>>>>   {
>>>>       tasklet_init(t, func, data);
>>>>       t->is_softirq = 1;
>>>> diff --git a/xen/common/timer.c b/xen/common/timer.c
>>>> index 0fddfa7487..bf7792dcb3 100644
>>>> --- a/xen/common/timer.c
>>>> +++ b/xen/common/timer.c
>>>> @@ -291,7 +291,7 @@ static bool active_timer(const struct timer *timer)
>>>>     void init_timer(
>>>>       struct timer *timer,
>>>> -    void        (*function)(void *),
>>>> +    void        (*function)(void *data),
>>>>       void         *data,
>>>>       unsigned int  cpu)
>>>>   {
>>>> @@ -441,7 +441,7 @@ void kill_timer(struct timer *timer)
>>>>     static void execute_timer(struct timers *ts, struct timer *t)
>>>>   {
>>>> -    void (*fn)(void *) = t->function;
>>>> +    void (*fn)(void *data) = t->function;
>>>>       void *data = t->data;
>>>>         t->status = TIMER_STATUS_inactive;
>>>> diff --git a/xen/include/xen/rangeset.h b/xen/include/xen/rangeset.h
>>>> index 135f33f606..390f7b6082 100644
>>>> --- a/xen/include/xen/rangeset.h
>>>> +++ b/xen/include/xen/rangeset.h
>>>> @@ -68,7 +68,7 @@ bool_t __must_check rangeset_overlaps_range(
>>>>       struct rangeset *r, unsigned long s, unsigned long e);
>>>>   int rangeset_report_ranges(
>>>>       struct rangeset *r, unsigned long s, unsigned long e,
>>>> -    int (*cb)(unsigned long s, unsigned long e, void *), void *ctxt);
>>>> +    int (*cb)(unsigned long s, unsigned long e, void *data), void *ctxt);
>>>
>>> Also here some of the functions use "arg" instead of ctxt
>>>
>>>
>>>>   /*
>>>>    * Note that the consume function can return an error value apart from
>>>> @@ -77,7 +77,7 @@ int rangeset_report_ranges(
>>>>    */
>>>>   int rangeset_consume_ranges(struct rangeset *r,
>>>>                               int (*cb)(unsigned long s, unsigned long e,
>>>> -                                      void *, unsigned long *c),
>>>> +                                      void *ctxt, unsigned long *c),
>>>>                               void *ctxt);
>>>
>>> Also here some of the functions use "dom" like irq_remove_cb.
>>>
>>>
>>> But I actually like the patch as is, so if that's OK from a MISRA point
>>> of view then I would give my reviewed-by.
>>
>> Yes, this is OK for MISRA.
> 
> 
> Reviewed-by: Stefano Stabellini <sstabellini@xxxxxxxxxx>

To cover EFI:
Acked-by: Jan Beulich <jbeulich@xxxxxxxx>

Jan



 


Rackspace

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