All of lore.kernel.org
 help / color / mirror / Atom feed
From: Jan Beulich <jbeulich@suse.com>
To: "xen-devel@lists.xenproject.org" <xen-devel@lists.xenproject.org>
Cc: "Nicola Vetrini" <nicola.vetrini@bugseng.com>,
	"Andrew Cooper" <andrew.cooper3@citrix.com>,
	"Julien Grall" <julien@xen.org>,
	"Stefano Stabellini" <sstabellini@kernel.org>,
	"Anthony PERARD" <anthony.perard@vates.tech>,
	"Michal Orzel" <michal.orzel@amd.com>,
	"Roger Pau Monné" <roger@xenproject.org>
Subject: [PATCH 12/14] gnttab: don't cast away constness
Date: Wed, 2 Sep 2026 08:35:47 +0200	[thread overview]
Message-ID: <1f55b457-c8cc-4ef9-ba5a-96e52b95fbbe@suse.com> (raw)
In-Reply-To: <0ff5676d-2ad3-49e3-a94b-90e7c3edb55f@suse.com>

While _set_status_v2() indeed doesn't alter the grant_entry_header_t it
is handed a pointer to, _set_status_v1() does. Drop the const from the
parameter of the latter (and then necessarily also from _set_status()'s),
while adding const to the local variable of the former.

No functional change.

Signed-off-by: Jan Beulich <jbeulich@suse.com>
---
Really I think it would be best if we did away with the raw_shah local
variables (which looks reasonably simple for at least _set_status_v2()).
I'm unconvinced that we really need to use ACCESS_ONCE() here. Torn reads
aren't a problem; what we require is that we look at a stable local copy,
and that can be achieved by putting barrier() after the reads.

--- a/xen/common/grant_table.c
+++ b/xen/common/grant_table.c
@@ -740,7 +740,7 @@ static unsigned int nr_grant_entries(str
     return 0;
 }
 
-static int _set_status_v1(const grant_entry_header_t *shah,
+static int _set_status_v1(grant_entry_header_t *shah,
                           struct domain *rd,
                           struct active_grant_entry *act,
                           int readonly,
@@ -832,7 +832,7 @@ static int _set_status_v2(const grant_en
                           domid_t  ldomid)
 {
     int      rc    = GNTST_okay;
-    uint32_t *raw_shah = (uint32_t *)shah;
+    const uint32_t *raw_shah = (const uint32_t *)shah;
     union grant_combo scombo;
     uint16_t mask  = GTF_type_mask;
 
@@ -909,7 +909,7 @@ done:
 }
 
 
-static int _set_status(const grant_entry_header_t *shah,
+static int _set_status(grant_entry_header_t *shah,
                        grant_status_t *status,
                        struct domain *rd,
                        unsigned int rgt_version,



  parent reply	other threads:[~2026-09-02  6:35 UTC|newest]

Thread overview: 27+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-09-02  6:28 [PATCH 00/14] address half the remaining Misra rule 11.8 violations Jan Beulich
2026-09-02  6:30 ` [PATCH 01/14] lib: obey to Misra rule 11.8 where possible Jan Beulich
2026-09-02  6:30 ` [PATCH 02/14] x86/bitops: don't cast away volatile-ness Jan Beulich
2026-09-02 11:29   ` Andrew Cooper
2026-09-02  6:31 ` [PATCH 03/14] x86: have cmpxchg16b() obey to Misra rule 11.8 Jan Beulich
2026-09-02  6:31 ` [PATCH 04/14] x86/boot: don't cast away const-ness Jan Beulich
2026-09-07  8:02   ` Roger Pau Monné
2026-09-02  6:32 ` [PATCH 05/14] x86/altcall: hide casting away of const Jan Beulich
2026-09-07  7:54   ` Roger Pau Monné
2026-09-02  6:32 ` [PATCH 06/14] Arm/alternative: " Jan Beulich
2026-09-02 11:47   ` Orzel, Michal
2026-09-02 12:35     ` Jan Beulich
2026-09-02  6:33 ` [PATCH 07/14] Arm64/GICv3: have gicv3_its_find_quirk() not cast away const-ness Jan Beulich
2026-09-02 11:22   ` Orzel, Michal
2026-09-02  6:33 ` [PATCH 08/14] Arm/guestcopy: deviate copy_guest() uses just like their x86 counterparts Jan Beulich
2026-09-07  6:37   ` Orzel, Michal
2026-09-02  6:34 ` [PATCH 09/14] ACPI: address a Misra rule 11.8 violation in Arm code Jan Beulich
2026-09-02  6:34 ` [PATCH 10/14] ELF/notes: use pointer-to-const by default in ELFNOTE_...() Jan Beulich
2026-09-02  6:35 ` [PATCH 11/14] crypto/vmac: don't cast away const-ness in aes_key_setup() Jan Beulich
2026-09-02  6:35 ` Jan Beulich [this message]
2026-09-02  6:36 ` [PATCH 13/14] passthrough/PCI: rework (s,b,d,f) init of struct pci_dev Jan Beulich
2026-09-02 12:44   ` Roger Pau Monné
2026-09-02 12:53     ` Jan Beulich
2026-09-02 15:07       ` Roger Pau Monné
2026-09-03  6:05         ` Jan Beulich
2026-09-02  6:37 ` [PATCH 14/14] xhci-dbc: don't cast away const-ness in xhci_find_dbc() Jan Beulich
2026-09-02  9:56   ` Marek Marczykowski-Górecki

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1f55b457-c8cc-4ef9-ba5a-96e52b95fbbe@suse.com \
    --to=jbeulich@suse.com \
    --cc=andrew.cooper3@citrix.com \
    --cc=anthony.perard@vates.tech \
    --cc=julien@xen.org \
    --cc=michal.orzel@amd.com \
    --cc=nicola.vetrini@bugseng.com \
    --cc=roger@xenproject.org \
    --cc=sstabellini@kernel.org \
    --cc=xen-devel@lists.xenproject.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.