[PATCH] xen/riscv: fix type mismatch in read_atomic_size()

Oleksii Kurochko posted 1 patch 2 months, 1 week ago
Patches applied successfully (tree, apply log)
git fetch https://gitlab.com/xen-project/patchew/xen tags/patchew/20240909112815.37921-1-oleksii.kurochko@gmail.com
xen/arch/riscv/include/asm/atomic.h | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
[PATCH] xen/riscv: fix type mismatch in read_atomic_size()
Posted by Oleksii Kurochko 2 months, 1 week ago
Correct a typo in read_atomic_size() where a 64-bit result
was incorrectly cast to a `uint32_t` instead of `uint64_t`
in the case of 8-byte reads.

Fixes: 3cd46d4ec8b9 ("xen/riscv: introduce atomic.h")
Reported-by: Andrew Cooper <andrew.cooper3@citrix.com>
Signed-off-by: Oleksii Kurochko <oleksii.kurochko@gmail.com>
---
 xen/arch/riscv/include/asm/atomic.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/xen/arch/riscv/include/asm/atomic.h b/xen/arch/riscv/include/asm/atomic.h
index 31b91a79c8..41f03b2e0c 100644
--- a/xen/arch/riscv/include/asm/atomic.h
+++ b/xen/arch/riscv/include/asm/atomic.h
@@ -45,7 +45,7 @@ static always_inline void read_atomic_size(const volatile void *p,
     case 2: *(uint16_t *)res = readw(p); break;
     case 4: *(uint32_t *)res = readl(p); break;
 #ifndef CONFIG_RISCV_32
-    case 8: *(uint32_t *)res = readq(p); break;
+    case 8: *(uint64_t *)res = readq(p); break;
 #endif
     default: __bad_atomic_size(); break;
     }
-- 
2.46.0
Re: [PATCH] xen/riscv: fix type mismatch in read_atomic_size()
Posted by Jan Beulich 2 months, 1 week ago
On 09.09.2024 13:28, Oleksii Kurochko wrote:
> Correct a typo in read_atomic_size() where a 64-bit result
> was incorrectly cast to a `uint32_t` instead of `uint64_t`
> in the case of 8-byte reads.
> 
> Fixes: 3cd46d4ec8b9 ("xen/riscv: introduce atomic.h")
> Reported-by: Andrew Cooper <andrew.cooper3@citrix.com>
> Signed-off-by: Oleksii Kurochko <oleksii.kurochko@gmail.com>

Reviewed-by: Jan Beulich <jbeulich@suse.com>