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

Re: [PATCH] misra/eclair: set 'noreturn' attribute as safe during cast


  • To: Jan Beulich <jbeulich@xxxxxxxx>
  • From: Dmytro Prokopchuk1 <dmytro_prokopchuk1@xxxxxxxx>
  • Date: Tue, 29 Jul 2025 10:04:31 +0000
  • Accept-language: en-US, uk-UA, ru-RU
  • Arc-authentication-results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=epam.com; dmarc=pass action=none header.from=epam.com; dkim=pass header.d=epam.com; arc=none
  • Arc-message-signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector10001; 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=od6xRjsF/LomqPTdEfum60583eacjXwDjf3+yCCltA0=; b=kmtmOokm5RkbsqZy6HxYi7ntOApdHh1nqQdj6Q6CbisiXSDFHfbO+me7ipzgZ+m5meQL06h9mDfUg/tI4ORwg4o/hTsioWx44HFqx1J1cZyfHxngCHVoQu8V3lOWjT6bL5cxx0mhEGy/71Lz26aenuA3R3+MzLtnQKrnnScBenAXUvI3RI9piCuMKDLozBhF69GLW9eALwSz9woqENVQ8BZWyKeesyNUMYPCsdxuIGeDSYBX0lcUT3ag5YWgNBos203SGGc0WDY7apsISS741JyCQkf+pudFplhd1payp6uoWJSHFVjn0/NhNB6GHd3zY+qde/VnyAsOWeigpScsZA==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=xRZyaBWhOdqIedjVmYZwafiWnT4pyXDz11AjQhqqYdij8l1PXfjcw6TqJdElsrhvQKHwmsPYb2CZe0HXeRw8MD/kYpTlvvxqSJlzG6PlJLt4JYUgOSzDWmJnV7SXo6CP+V97viy08nFIGF31ZkT1kFN3s9+sn+1YMGDiymrWLD5PzgFtfHbiROxR+/Yx4weYleudWshDBDznK6kPS1VTqpKuYEj34M9HlqgRw4tUfA7/OKNO87pseOif3JM6GOlp3SrjyrgJ9LC6X8uOCydzPdr2rFVk71Dcuf9y4f7DS8+S9sz+UX9jyZkAJ3GVIx8eoUVuJfc5HaJftO2dTl0AvQ==
  • Authentication-results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=epam.com;
  • Cc: Nicola Vetrini <nicola.vetrini@xxxxxxxxxxx>, Doug Goldstein <cardoe@xxxxxxxxxx>, Stefano Stabellini <sstabellini@xxxxxxxxxx>, Andrew Cooper <andrew.cooper3@xxxxxxxxxx>, Anthony PERARD <anthony.perard@xxxxxxxxxx>, Michal Orzel <michal.orzel@xxxxxxx>, Julien Grall <julien@xxxxxxx>, Roger Pau Monné <roger.pau@xxxxxxxxxx>, "xen-devel@xxxxxxxxxxxxxxxxxxxx" <xen-devel@xxxxxxxxxxxxxxxxxxxx>
  • Delivery-date: Tue, 29 Jul 2025 10:04:55 +0000
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>
  • Thread-index: AQHcAA0QZaFBUUSap0maTjLkZJJTcbRIvq4AgAAhkoA=
  • Thread-topic: [PATCH] misra/eclair: set 'noreturn' attribute as safe during cast


On 7/29/25 11:04, Jan Beulich wrote:
> On 29.07.2025 00:15, Dmytro Prokopchuk1 wrote:
>> ECLAIR reports a non-compliant cast due to the presence
>> of the 'noreturn' attribute in the callee function.
>
> Which callee function? Which cast? Please be concrete. You don't need
> to enumerate all case, but one specific example wants pointing at.
>
>> The issue occurs when casting a function pointer with
>> the 'noreturn' attribute (void noreturn (*)(void *))
>> to a general function pointer type (void (*)(void *)).
>
> And again - why "casting"? As per ...
>
>> Configure ECLAIR to treat 'noreturn' attributes as safe
>> in this conversion.
>>
>> Signed-off-by: Dmytro Prokopchuk <dmytro_prokopchuk1@xxxxxxxx>
>> ---
>> Previous discussion thread:
>> https://patchew.org/Xen/181a03d5c7625d42c06cf9fa0cf48a9bc6825361.1753647875.git.dmytro._5Fprokopchuk1@xxxxxxxx/
>
> ... there was no cast involved, iirc. We specifically rejected your
> attempt to add a cast there. It's a conversion the compiler does, aiui.
>
> Jan
Yes, you are right.
Word "cast" is not appropriate there.

Below is updated text:

     misra: allow 'noreturn' as safe for function pointer conversions

     The conversion from a function pointer with the
     'noreturn' attribute ('void noreturn (*)(void *)')
     to a function pointer type ('void (*)(void *)'
     causes type incompatibility according to
     MISRA C Rule 11.1, which forbids conversions
     between incompatible function pointer types.

     The violation occurs at the call site
         smp_call_function(halt_this_cpu, NULL, 0);
     where 'halt_this_cpu' with type 'void noreturn (*)(void *)'
     is passed to 'smp_call_function' expecting a function
     pointer of type 'void (*)(void *)'.

     The 'noreturn' attribute does not change the function
     calling convention or parameter handling at runtime,
     making the conversion safe.
     Configure ECLAIR to treat 'noreturn' attributes as safe.

Dmytro.

 


Rackspace

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