Skip to content
Commit 5478afc5 authored by Alexander Potapenko's avatar Alexander Potapenko Committed by Andrew Morton
Browse files

kmsan: fix memcpy tests

Recent Clang changes may cause it to delete calls of memcpy(), if the
source is an uninitialized volatile local.  This happens because passing a
pointer to a volatile local into memcpy() discards the volatile qualifier,
giving the compiler a free hand to optimize the memcpy() call away.

Use OPTIMIZER_HIDE_VAR() to hide the uninitialized var from the too-smart
compiler.

Link: https://lkml.kernel.org/r/20221205145740.694038-1-glider@google.com


Signed-off-by: default avatarAlexander Potapenko <glider@google.com>
Suggested-by: default avatarMarco Elver <elver@google.com>
Reviewed-by: default avatarMarco Elver <elver@google.com>
Cc: Dmitry Vyukov <dvyukov@google.com>
Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
parent de2e5171
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment