diff mbox series

[kvm-unit-tests,2/2] x86: remove use of compiler's memset from emulator.c

Message ID 20210511015016.815461-2-jacobhxu@google.com (mailing list archive)
State New, archived
Headers show
Series [kvm-unit-tests,1/2] x86: Do not assign values to unaligned pointer to 128 bits | expand

Commit Message

Jacob Xu May 11, 2021, 1:50 a.m. UTC
Per Sean in discussion of the previous patch, "using the compiler's
memset() in kvm-unit-tests seems inherently dangerous since the tests
are often doing intentionally stupid things."

The string.h memset is already imported through libcflat.h, so let's use
that instead.

Suggested-by: Sean Christopherson <seanjc@google.com>
Signed-off-by: Jacob Xu <jacobhxu@google.com>
---
 x86/emulator.c | 1 -
 1 file changed, 1 deletion(-)

Comments

Sean Christopherson May 11, 2021, 9:13 p.m. UTC | #1
On Mon, May 10, 2021, Jacob Xu wrote:
> Per Sean in discussion of the previous patch, "using the compiler's
> memset() in kvm-unit-tests seems inherently dangerous since the tests
> are often doing intentionally stupid things."
> 
> The string.h memset is already imported through libcflat.h, so let's use
> that instead.
> 
> Suggested-by: Sean Christopherson <seanjc@google.com>
> Signed-off-by: Jacob Xu <jacobhxu@google.com>
> ---

Reviewed-by: Sean Christopherson <seanjc@google.com>
diff mbox series

Patch

diff --git a/x86/emulator.c b/x86/emulator.c
index 1d5c172..d6e31bf 100644
--- a/x86/emulator.c
+++ b/x86/emulator.c
@@ -8,7 +8,6 @@ 
 #include "alloc_page.h"
 #include "usermode.h"
 
-#define memset __builtin_memset
 #define TESTDEV_IO_PORT 0xe0
 
 #define MAGIC_NUM 0xdeadbeefdeadbeefUL