From dd8df2b112a8e374af87f5fb35e6fe2bd0aa2c36 Mon Sep 17 00:00:00 2001 From: Download-Fritz Date: Thu, 1 Nov 2018 07:27:02 +0100 Subject: [PATCH] OcGuardLib: Use EFIAPI for functions involving VA. --- Library/OcGuardLib/Ubsan.c | 3 ++- Library/OcGuardLib/Ubsan.h | 8 ++++---- Library/OcGuardLib/UbsanPrintf.c | 10 +++++----- 3 files changed, 11 insertions(+), 10 deletions(-) diff --git a/Library/OcGuardLib/Ubsan.c b/Library/OcGuardLib/Ubsan.c index a6eb5510..2eb389be 100644 --- a/Library/OcGuardLib/Ubsan.c +++ b/Library/OcGuardLib/Ubsan.c @@ -237,7 +237,7 @@ struct CFloatCastOverflowData { }; /* Local utility functions */ -static void Report(bool isFatal, const char *pFormat, ...) __printflike(2, 3); +static void EFIAPI Report(bool isFatal, const char *pFormat, ...) __printflike(2, 3); static bool isAlreadyReported(struct CSourceLocation *pLocation); static size_t zDeserializeTypeWidth(struct CTypeDescriptor *pType); static void DeserializeLocation(char *pBuffer, size_t zBUfferLength, struct CSourceLocation *pLocation); @@ -1118,6 +1118,7 @@ __ubsan_get_current_report_data(const char **ppOutIssueKind, const char **ppOutM /* Local utility functions */ static void +EFIAPI Report(bool isFatal, const char *pFormat, ...) { va_list ap; diff --git a/Library/OcGuardLib/Ubsan.h b/Library/OcGuardLib/Ubsan.h index f537a96d..2fcab234 100644 --- a/Library/OcGuardLib/Ubsan.h +++ b/Library/OcGuardLib/Ubsan.h @@ -165,11 +165,11 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. // C-style printing support. #define TINYPRINTF_DEFINE_TFP_SPRINTF 1 typedef void (*putcf) (void *, char); -void tfp_format(void *putp, putcf putf, const char *fmt, va_list va); +void EFIAPI tfp_format(void *putp, putcf putf, const char *fmt, va_list va); int tfp_vsnprintf(char *str, size_t size, const char *fmt, va_list ap); -int tfp_snprintf(char *str, size_t size, const char *fmt, ...) __printflike(3, 4); -int tfp_vsprintf(char *str, const char *fmt, va_list ap); -int tfp_sprintf(char *str, const char *fmt, ...) __printflike(2, 3); +int EFIAPI tfp_snprintf(char *str, size_t size, const char *fmt, ...) __printflike(3, 4); +int EFIAPI tfp_vsprintf(char *str, const char *fmt, va_list ap); +int EFIAPI tfp_sprintf(char *str, const char *fmt, ...) __printflike(2, 3); // Redirect log printing to standard output. #define snprintf tfp_snprintf diff --git a/Library/OcGuardLib/UbsanPrintf.c b/Library/OcGuardLib/UbsanPrintf.c index 0c5456d8..8e9d94b2 100644 --- a/Library/OcGuardLib/UbsanPrintf.c +++ b/Library/OcGuardLib/UbsanPrintf.c @@ -258,7 +258,7 @@ static void putchw(void *putp, putcf putf, struct param *p) } } -void tfp_format(void *putp, putcf putf, const char *fmt, va_list va) +void EFIAPI tfp_format(void *putp, putcf putf, const char *fmt, va_list va) { struct param p; #ifdef PRINTF_LONG_SUPPORT @@ -438,7 +438,7 @@ void init_printf(void *putp, putcf putf) stdout_putp = putp; } -void tfp_printf(char *fmt, ...) +void EFIAPI tfp_printf(char *fmt, ...) { va_list va; va_start(va, fmt); @@ -483,7 +483,7 @@ int tfp_vsnprintf(char *str, size_t size, const char *format, va_list ap) return data.num_chars; } -int tfp_snprintf(char *str, size_t size, const char *format, ...) +int EFIAPI tfp_snprintf(char *str, size_t size, const char *format, ...) { va_list ap; int retval; @@ -506,7 +506,7 @@ static void _vsprintf_putcf(void *p, char c) data->dest[data->num_chars++] = c; } -int tfp_vsprintf(char *str, const char *format, va_list ap) +int EFIAPI tfp_vsprintf(char *str, const char *format, va_list ap) { struct _vsprintf_putcf_data data; data.dest = str; @@ -516,7 +516,7 @@ int tfp_vsprintf(char *str, const char *format, va_list ap) return data.num_chars; } -int tfp_sprintf(char *str, const char *format, ...) +int EFIAPI tfp_sprintf(char *str, const char *format, ...) { va_list ap; int retval;