[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [PATCH] misra: add deviation of Rule 17.7
- To: Jan Beulich <jbeulich@xxxxxxxx>
- From: Dmytro Prokopchuk1 <dmytro_prokopchuk1@xxxxxxxx>
- Date: Mon, 25 Aug 2025 13:27:44 +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=+X5jyYQeGpg9rJyPL3XVX1P8S6+1/ZgUDi67/qI/grA=; b=NlIc8cztIGenQfuqvxT2UEIRNAIZU2cIlpQzGHJxLFmaHqv04bXP1NzuFmUjQ1Tvog5exIQ6Msj5y5l/T0pAJw7DbokdPwWV+WY3NECGtVsUSQzACgc2Q9h1Om3IIvRFPbUr6/vHas95ESxA3Mbbo0GrMC1fQPgspoaGDSZBybMzwLd84vcjXQu9OpJlpUizDj6olMM+eEDbOvS3dEQHR3o1aua7c9uFUuLnhVhhMyaXDyVBZFrtKrOitiTEfYO0zcbS1VS+oo3/Kv1qppm3qh0qjwyit63TaCt4yHBGLFzGpeODoeqxBwOFQ6OdLHbRMSUUcb3wDqqNekf8t9hq4g==
- Arc-seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=zFCc2XU8NZnJmq71ded1bBaeAG888sRu5sT+aL2KMtFUVjW4rRXeVDMPv876nCtJdlqDGvql7mUfuV3sNOrn4zJjIiBexZMcBbr+5tRgvVomcaU+6azh6DFK6cLJI7r539yRUXPAh8BJl3zFQGG8f6/ZGQMb5rYlnbwF3ojBvgEef2n5vs5Cb34jTZlWDWI8MOfqlnM+tuOt7+qZP6Lo+aZK9owgJC+EJjaSTPJJTmLGDPb8VycY4D8X+QyvzPPSkYQlnMeNO9ey7dQqs6RxXTp7zmAOvIB+BUjpGLIm8mVrLcY+2u9KS+HbqZ0M8zeYJmUiGyGeVdcMCDXC+IrAAA==
- 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: Mon, 25 Aug 2025 13:28:01 +0000
- List-id: Xen developer discussion <xen-devel.lists.xenproject.org>
- Thread-index: AQHcFZ9zsboRH18vd0iLUvum4pfwBbRzK0qAgAAH1ACAAAJ8AIAAJzmA
- Thread-topic: [PATCH] misra: add deviation of Rule 17.7
On 8/25/25 14:07, Jan Beulich wrote:
> On 25.08.2025 12:58, Dmytro Prokopchuk1 wrote:
>> On 8/25/25 13:30, Jan Beulich wrote:
>>> On 25.08.2025 11:05, Dmytro Prokopchuk1 wrote:
>>>> MISRA C Rule 17.7 states: "The value returned by a function having
>>>> non-void return type shall be used."
>>>>
>>>> Deviate functions like 'memcpy()', 'memset()', 'memmove()', 'snprintf()',
>>>> 'strlcpy()', 'strlcat()', as they return a value purely for convenience,
>>>> their primary functionality (e.g., memory or string operations) remains
>>>> unaffected, and their return values are generally non-critical and seldom
>>>> relied upon. Update 'deviations.rst' file accordingly.
>>>
>>> How come snprintf() is among this set? Its return value isn't quite just
>>> for convenience, imo.
>>
>> Yes, snprintf()'s return value isn't just for convenience. The deviation
>> justification is primarily based on the fact that its return value is
>> rarely used in the Xen source base. Most callers of snprintf() don't
>> care about return value. So, snprintf() is in this list.
>>
>> Maybe separate wording is required for the snprintf() ?
>
> Minimally. Personally I don't think it should be deviated globally.
>
> Jan
There are approximately 230 instances of snprintf() being used without
checking its return value (across ARM and x86) in around 20 different
source files. Deviation each of them could be complicated.
Dmytro.
|