From: Benjamin Gray <bgray@linux.ibm.com>
To: linuxppc-dev@lists.ozlabs.org
Cc: Benjamin Gray <bgray@linux.ibm.com>
Subject: [PATCH 12/12] powerpc/fadump: Annotate endianness cast with __force
Date: Wed, 11 Oct 2023 16:37:11 +1100 [thread overview]
Message-ID: <20231011053711.93427-13-bgray@linux.ibm.com> (raw)
In-Reply-To: <20231011053711.93427-1-bgray@linux.ibm.com>
Sparse reports an endianness error with the else case of
val = (cpu_endian ? be64_to_cpu(reg_entry->reg_val) :
(u64)(reg_entry->reg_val));
This is a safe operation because the code is explicitly working with
dynamic endianness, so add the __force annotation to tell Sparse to
ignore it.
Signed-off-by: Benjamin Gray <bgray@linux.ibm.com>
---
arch/powerpc/platforms/powernv/opal-fadump.h | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/arch/powerpc/platforms/powernv/opal-fadump.h b/arch/powerpc/platforms/powernv/opal-fadump.h
index 3f715efb0aa6..5eeb794b5eb1 100644
--- a/arch/powerpc/platforms/powernv/opal-fadump.h
+++ b/arch/powerpc/platforms/powernv/opal-fadump.h
@@ -135,7 +135,7 @@ static inline void opal_fadump_read_regs(char *bufp, unsigned int regs_cnt,
for (i = 0; i < regs_cnt; i++, bufp += reg_entry_size) {
reg_entry = (struct hdat_fadump_reg_entry *)bufp;
val = (cpu_endian ? be64_to_cpu(reg_entry->reg_val) :
- (u64)(reg_entry->reg_val));
+ (u64 __force)(reg_entry->reg_val));
opal_fadump_set_regval_regnum(regs,
be32_to_cpu(reg_entry->reg_type),
be32_to_cpu(reg_entry->reg_num),
--
2.39.2
next prev parent reply other threads:[~2023-10-11 5:46 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-10-11 5:36 [PATCH 00/12] Miscellaneous Sparse fixes Benjamin Gray
2023-10-11 5:37 ` [PATCH 01/12] powerpc/xive: Fix endian conversion size Benjamin Gray
2023-10-11 5:37 ` [PATCH 02/12] powerpc/pseries: Restructure hvc_get_chars() endianness Benjamin Gray
2023-10-30 13:16 ` Aneesh Kumar K.V
2024-02-20 7:10 ` Christophe Leroy
2023-10-11 5:37 ` [PATCH 03/12] powerpc: Explicitly reverse bytes when checking for byte reversal Benjamin Gray
2023-10-11 5:37 ` [PATCH 04/12] powerpc: Use NULL instead of 0 for null pointers Benjamin Gray
2023-10-11 5:37 ` [PATCH 05/12] powerpc: Remove extern from function implementations Benjamin Gray
2023-10-11 5:37 ` [PATCH 06/12] powerpc: Annotate endianness of various variables and functions Benjamin Gray
2023-10-11 5:37 ` [PATCH 07/12] powerpc/kvm: Force cast endianness of KVM shared regs Benjamin Gray
2023-10-11 5:37 ` [PATCH 08/12] powerpc/opal: Annotate out param endianness Benjamin Gray
2023-10-11 5:37 ` [PATCH 09/12] powerpc/uaccess: Cast away __user annotation after verification Benjamin Gray
2023-10-11 5:37 ` [PATCH 10/12] powerpc: Cast away __iomem in low level IO routines Benjamin Gray
2023-10-11 5:37 ` [PATCH 11/12] powerpc/eeh: Remove unnecessary cast Benjamin Gray
2023-10-11 5:37 ` Benjamin Gray [this message]
2023-10-27 9:59 ` (subset) [PATCH 00/12] Miscellaneous Sparse fixes Michael Ellerman
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=20231011053711.93427-13-bgray@linux.ibm.com \
--to=bgray@linux.ibm.com \
--cc=linuxppc-dev@lists.ozlabs.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).