aboutsummaryrefslogtreecommitdiff
path: root/src/commonlib
diff options
context:
space:
mode:
authorRyan Salsamendi <rsalsamendi@hotmail.com>2017-06-16 13:15:31 -0700
committerMartin Roth <martinroth@google.com>2017-06-20 03:13:18 +0200
commitf511c1f11895397606be103823fd3a33c6e92811 (patch)
tree6a7b16ed03e950fa04100f6a857f1488289bea36 /src/commonlib
parent927f06a565dcbf973739e2c91cc1ea2814338609 (diff)
arch/x86/ebda: Change memcpy() to endian wrappers
Change memcpy()s and memset()s to endian.h wrappers for consistency and safety. Add zero_n() wrapper to safely clear memory. Change-Id: If155d82608c81992f05eae4d2223de6f506e98c5 Signed-off-by: Ryan Salsamendi <rsalsamendi@hotmail.com> Reviewed-on: https://review.coreboot.org/20240 Tested-by: build bot (Jenkins) <no-reply@coreboot.org> Reviewed-by: Aaron Durbin <adurbin@chromium.org>
Diffstat (limited to 'src/commonlib')
-rw-r--r--src/commonlib/include/commonlib/endian.h6
1 files changed, 6 insertions, 0 deletions
diff --git a/src/commonlib/include/commonlib/endian.h b/src/commonlib/include/commonlib/endian.h
index 1ec472f5d2..7b08eee7af 100644
--- a/src/commonlib/include/commonlib/endian.h
+++ b/src/commonlib/include/commonlib/endian.h
@@ -18,6 +18,7 @@
#include <stddef.h>
#include <stdint.h>
+#include <string.h>
/* Endian agnostic functions working on single byte. */
@@ -254,4 +255,9 @@ static inline void write_at_le64(void *dest, uint64_t val, size_t offset)
write_le64(d, val);
}
+static inline void zero_n(void *dest, size_t n)
+{
+ memset(dest, 0, n);
+}
+
#endif