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

Re: [PATCH v1] misra: add deviation of Rule 10.1 for unary minus


  • To: xen-devel@xxxxxxxxxxxxxxxxxxxx
  • From: "Lira, Victor M" <VictorM.Lira@xxxxxxx>
  • Date: Wed, 23 Apr 2025 11:06:41 -0700
  • Arc-authentication-results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=amd.com; dmarc=pass action=none header.from=amd.com; dkim=pass header.d=amd.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=xqa79jWDei+TUXbfbLVhNP53IHh/2vbDRB+8d+FW/VQ=; b=E5OGJk9Jpxw73vyjwA5kKW85RXDyI7Pm9kdhe6MGLop+5r3TVwHZCu5zWMsH/oTXw350AMbiE1xF4IFVN4d2kQfQzs0MG7CJOdpa2OYF5vAUH5MVwUf1wZ1s+BkjL+tv16AvosN0B9fMQyihAzYx05E/CmhK0Egz6h5W+/ya/fpbcKUmrcKIurmE85nNNuNaNIA8ZlJQfShtY0ezUZbBqbViCY+q5/ZCbp0pBri6dHR9zkjXoc+Ht4uJnxVlkCa/z8+rLWAqKmKSc1IIfiNqBt/dojLVLUaeKhf5m9QflsQwKzz06/gW0bWB7TmLpXBeFA6b6lr/00iB45qkS0WciQ==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=HNSlVED9QV/Rp6sUX/8LijlRaVsyF83F5av8Xj9rq7dn5S1OPhLa8xToN6YAgmYykN4UiULbLKsa0W+YYVZmPq2T8CiGze5KAzsuLOxagu9zvHTNnO5Kj4j/gSBMa4x15EhS0oLsNOxk48G7iN9GNkIWY2hOvijd0NB5XSpFykuvGj6weKYUCcDjZOfT5QYfga9neLNAOQMSTAE+F00pbOksTjKLVX0oAPeASZBvv9TQmIAh9IB58r41NjQOOZIfHHjIFfl5ZB7Z2JU4L5mkDtVB6jwROVg2ohJuxQSVxBkqWkII19UFePNvU434eHIxq/TdYyLseFouOivmlIa1Hg==
  • Authentication-results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=amd.com;
  • Cc: Nicola Vetrini <nicola.vetrini@xxxxxxxxxxx>, Federico Serafini <federico.serafini@xxxxxxxxxxx>, Andrew Cooper <andrew.cooper3@xxxxxxxxxx>, Anthony PERARD <anthony.perard@xxxxxxxxxx>, Michal Orzel <michal.orzel@xxxxxxx>, Jan Beulich <jbeulich@xxxxxxxx>, Julien Grall <julien@xxxxxxx>, Roger Pau Monné <roger.pau@xxxxxxxxxx>, Stefano Stabellini <sstabellini@xxxxxxxxxx>, Bertrand Marquis <bertrand.marquis@xxxxxxx>
  • Delivery-date: Wed, 23 Apr 2025 18:06:54 +0000
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>

Continuing a discussion from before:

On 4/22/2025 11:51 PM, Jan Beulich wrote:
Caution: This message originated from an External Source. Use proper caution 
when opening attachments, clicking links, or responding.


On 23.04.2025 01:43, victorm.lira@xxxxxxx wrote:
From: Nicola Vetrini <nicola.vetrini@xxxxxxxxxxx>

The unary minus operator applied to an unsigned quantity has
a semantics (wrap around) that is well-known to all Xen developers.
Thus, this operation is deemed safe.
Please, as you have it in the other two patches, can the rule title be
reproduced in such patches? As it stands, without mentioning the doc
version either, someone finding this later on may be left with a pretty
wide ambiguity as to what's meant.
OK I'll include the rule title in the commit message.
--- a/automation/eclair_analysis/ECLAIR/deviations.ecl
+++ b/automation/eclair_analysis/ECLAIR/deviations.ecl
@@ -347,6 +347,12 @@ constant expressions are required.\""
    "any()"}
  -doc_end

+-doc_begin="Unary minus operations on non-negative integers have a semantics (wrap 
around) that is well-known to all Xen developers."
Why "non-negative"? A variable of type "int" holding a non-negative value is,
aiui, well within the bounds of the rule here. It's unsigned types where the
use of unary minus would constitute a violation. You actually say so ...
+   * - R10.1
+     - Applying the unary minus operator to an unsigned quantity has a
+       semantics (wrap around) that is well-known to all Xen developers.
+       For this reason, the operation is safe.
+     - Tagged as `safe` for ECLAIR.
... here, just that this one's getting blurred by using "quantity" when
"type" is meant. Imo we need to be pretty precise here, using terminology
that's used by the standard or the Misra rules, and not anything "coming
close enough" in someone's perception.
OK, I agree it should say unsigned type(s) in both of these.


Victor



 


Rackspace

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