diff options
| author | Daniel Borkmann <daniel@iogearbox.net> | 2026-08-07 23:04:17 +0200 |
|---|---|---|
| committer | Daniel Borkmann <daniel@iogearbox.net> | 2026-08-07 23:04:17 +0200 |
| commit | e1d9b82db5447c88405b216f9c5c87daedaa2971 (patch) | |
| tree | 3aa8b323f87d49b0293a2ef1e69dcb5434fbb586 /arch/x86/boot/string.c | |
| parent | 2b1f9f69ae25cb46d0a84ff14398596eb2bfce44 (diff) | |
| parent | a13307e97d5c54b65720bb71fa379960ded1e51a (diff) | |
Merge git://git.kernel.org/pub/scm/linux/kernel/git/bpf/bpf 7.2-rc7
Cross-merge BPF and other fixes after downstream PR.
Signed-off-by: Daniel Borkmann <daniel@iogearbox.net>
Diffstat (limited to 'arch/x86/boot/string.c')
| -rw-r--r-- | arch/x86/boot/string.c | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/arch/x86/boot/string.c b/arch/x86/boot/string.c index ac0f900ebc47..1632d40e1f54 100644 --- a/arch/x86/boot/string.c +++ b/arch/x86/boot/string.c @@ -32,8 +32,15 @@ int memcmp(const void *s1, const void *s2, size_t len) { bool diff; - asm("repe cmpsb" - : "=@ccnz" (diff), "+D" (s1), "+S" (s2), "+c" (len)); + + /* + * Make sure ZF is properly set in the len==0 case because in it, + * RCX==0 and the REPE; CMPSB won't get executed. + */ + asm volatile("test %3, %3\n\t" + "repe cmpsb" + : "=@ccnz" (diff), "+D" (s1), "+S" (s2), "+c" (len) + : : "cc", "memory"); return diff; } |
