[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 10:58:26 +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=dEISZrt/gaYc0myVXduKx+Lmkyab4dXBNrapmompVvM=; b=BI7uQ31uyXmXYScU9SVz7j+CcBRxmfFmLKGO88DzkAyKMT9Ca0+SvbnjPEZRX42qfZv2Xid+LDb4sWgI1+MnVIZzKm07pCQDSLD8Y0K8fwUMhkOFlKRFy/F73oX9OtlIDMj8zoiJDgix2peHpKVPTfOOxEd7Zvnm79wKKFwDAjhzlmiN74ZsXBL/AWVYG7xiGroF9Gf9rZ6ISHHm8Vope/vHyuaeaG7KBC4L0f+di/SKq1srCgwkd3S/Zu9fB70F7qwoK8TBQCDfEzZ/2H683W9kNgiH2pxndyN9lZxYwz7CgNNPSn8GsrzUUfC02j9xvinwDIlSedn9gNGA8VpkYA==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=L50D9NfBaarxoUi5UUifOLCnB9FVRhwCcYGWyYe95I5BZKB/Q4fRCQljFVzgvFe2PiTaEtCDAMSbVqdttqKwlGAxp0eqjTXV8S+h7ca9SO6YI18mBy/wug6aa9WrCqtZZ7ucwwwV3gpgmlRV4rHi7pvltKuuBSEGI4inL7ViDPGCfNLP1cU39BOpRIDmsoAmV8zqpZBmtDI/KvNEJOe3D+Wmxsq2TR0PGmxHNzUN+HP6BSmgD7esXTsj2hIfto2wC97j6JsKUoOLAuKysOYWisaJVakKolplPFv2G6Bs3yHF41PD2ilhAqfdyLSF4u3D6Vo8JLvnE/3MDJfdwbiz2A==
  • 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 10:58:40 +0000
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>
  • Thread-index: AQHcFZ9zsboRH18vd0iLUvum4pfwBbRzK0qAgAAH1AA=
  • Thread-topic: [PATCH] misra: add deviation of Rule 17.7


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.
> 
> Jan

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() ?

Dmytro.

 


Rackspace

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