Skip to content
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
util: Fix the constant length check in the aarch64 mmio_memcpy_x64()
__builtin_constant_p((bytecount) == 64) is true when the comparison has
a known result, whatever that result is, so the macro writes only 64
bytes for any length the compiler can reason about. A literal 128 is
truncated, and so is a variable after "if (n <= 64) return;".

Take the 64-byte path only when the length is known to be 64. libhns
was the one in-tree caller that relied on the old behaviour, and the
previous patch removes that.

Fixes: 159933c ("libhns: Add support for direct wqe")
Reviewed-by: Junxian Huang <huangjunxian6@hisilicon.com>
Tested-by: Junxian Huang <huangjunxian6@hisilicon.com>
Assisted-by: Claude:claude-opus-5-5 <noreply@anthropic.com>
Signed-off-by: Dezhen Lu <dezhen.lu@student.uni-tuebingen.de>
  • Loading branch information
0z5a committed Nov 9, 2026
commit b9c03596bafe18d4c311bd41d7f77f8e9a0396bb
2 changes: 1 addition & 1 deletion util/mmio.h
Original file line number Diff line number Diff line change
Expand Up @@ -258,7 +258,7 @@ static inline void _mmio_memcpy_x64(void *dest, const void *src, size_t bytecnt)

#define mmio_memcpy_x64(dest, src, bytecount) \
({ \
if (__builtin_constant_p((bytecount) == 64)) \
if (__builtin_constant_p(bytecount) && (bytecount) == 64) \
_mmio_memcpy_x64_64b((dest), (src)); \
else \
_mmio_memcpy_x64((dest), (src), (bytecount)); \
Expand Down