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

Re: [PATCH v2] misra: add deviation of Rule 17.7


  • To: Nicola Vetrini <nicola.vetrini@xxxxxxxxxxx>, Jan Beulich <jbeulich@xxxxxxxx>
  • From: Dmytro Prokopchuk1 <dmytro_prokopchuk1@xxxxxxxx>
  • Date: Tue, 26 Aug 2025 13:14:50 +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=9jVyVjiXzqcxNxQqZeMhfDy5QM7dp/C8zFY+rhrgafc=; b=i373He44g1uhmAPigarXJVfE3oTUYYb+QGe3HOEe9a+3h+2MxZ+tGvTtOcdS5xUiGEgVGPKupqTYh0LzLPL89EncWcG0tdujgJOs9KVEB4n5Aqa6+bqWVB/l4wk+Nl5MN2dYImyd1gypfI4em9PM8sxVGyferhWOVjUjN94aEjeP6DrcAUvS9E+CV/Hiu4GCH83FDXt0FV0mJWr5w2QbQ39jrMkmGLByKO+EHlygExzT5HTkzLfj9ixT0RsiXjIg0j57v7VmId01Mt+McgqZg1Hjg26HXg/rnfqq+C14DLwvKBHLSgu/H+nUpTnWOKa33CZZ5XXMuUoWHcxnd27L1A==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=zLgR0RXgHUWUx8bl6RlxL+e+TZDWoMWynab84FW4Mt1TOyCKzxLcu+O0Xa2sEqCKa7A0hsttO2tXsTxchRjOoZQ/wrEmNyK10BrxIPxslMxfFLqiqxl3nKdWRD++i5v+z6RlR2psmcKKt5Iku7H5vhMjVzR0+hgUAaXrbv2MUIgQE4F8xJZudrOJEiRjnVm2uoD/7rf5hfNciUN+HUUSCf5p4zNGa+pKrN8p4zeeWho0mL1fh8+0xOnutjEXlkiljxtYKAP8yM+UAgNri8YS8SM+sJZnEkPVOW0zRE99LUpVyyRcxmw7MqPXLQqjJko4apAVYs2ZXm6NHsIwDRu4ig==
  • Authentication-results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=epam.com;
  • Cc: 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, 26 Aug 2025 13:15:11 +0000
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>
  • Thread-index: AQHcFlwdO9JZfbniJ0qkcPaDWppdx7R0jhQAgAADC4CAAFj1gA==
  • Thread-topic: [PATCH v2] misra: add deviation of Rule 17.7


On 8/26/25 10:56, Nicola Vetrini wrote:
> On 2025-08-26 09:45, Jan Beulich wrote:
>> On 26.08.2025 09:36, Dmytro Prokopchuk1 wrote:
>>> --- a/automation/eclair_analysis/ECLAIR/deviations.ecl
>>> +++ b/automation/eclair_analysis/ECLAIR/deviations.ecl
>>> @@ -575,6 +575,11 @@ safe."
>>>  -config=MC3A2.R17.7,calls+={safe, "any()", 
>>> "decl(name(__builtin_memcpy||__builtin_memmove||__builtin_memset|| 
>>> cpumask_check))"}
>>>  -doc_end
>>>
>>> +-doc_begin="It is safe to deviate functions like 'memcpy()', 
>>> 'memset()', 'memmove()', as they return a value purely for convenience,
>>> +their primary functionality (memory manipulation) remains 
>>> unaffected, and their return values are generally non-critical and 
>>> seldom relied upon."
>>> +-config=MC3A2.R17.7,calls+={safe, "any()", "decl(name(memcpy|| 
>>> memset||memmove))"}
>>> +-doc_end
>>> +
>>>  #
>>>  # Series 18.
>>>  #
>>> --- a/docs/misra/deviations.rst
>>> +++ b/docs/misra/deviations.rst
>>> @@ -576,6 +576,13 @@ Deviations related to MISRA C:2012 Rules:
>>>           - __builtin_memset()
>>>           - cpumask_check()
>>>
>>> +   * - R17.7
>>> +     - It is safe to deviate functions like 'memcpy()', 'memset()', 
>>> 'memmove()',
>>> +       as they return a value purely for convenience, their primary 
>>> functionality
>>> +       (memory manipulation) remains unaffected, and their return 
>>> values are
>>> +       generally non-critical and seldom relied upon.
>>> +     - Tagged as `safe` for ECLAIR.
>>
>> I realize I may be overly nitpicky here, but in files named 
>> deviations.* I find it
>> odd to read "It is safe to deviate ...". I further find the use of 
>> "like" odd when
>> you enumerate the complete set anyway.

Updated wording (probably for the v3, if it's fine):

The functions 'memcpy()', 'memset()', and 'memmove()' return values 
primarily for convenience.
The core functionality of these functions (memory manipulation) remains 
unaffected, and their return values
are generally non-critical and seldom relied upon. Therefore, deviations 
from this rule regarding their use
can be considered safe.

Dmytro.

>>
>> I wonder whether the deviation wants generalizing anyway: 
>> Informational return
>> values are generally okay to ignore. That is, the Eclair configuration 
>> would be
>> limited to the three functions for now, but the text / comment could 
>> already be
>> broader. Then, for example, open-coded uses of the corresponding 
>> builtin functions
>> would also be covered right away.
>>
> 
> While I understand the pragmatic reasoning, from a MISRA compliance 
> standpoint it would be better not to make the written justification and 
> the actual deviation diverge, and then wide both the ECLAIR 
> configuration and its justification suitably once new cases want to be 
> deviated. Other than that,
> 
> Reviewed-by: Nicola Vetrini <nicola.vetrini@xxxxxxxxxxx>
> 

 


Rackspace

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