From 57236f2dd93c0451e68aa9231eb4514c45218804 Mon Sep 17 00:00:00 2001 From: Glenn Washburn Date: Thu, 4 Mar 2021 18:22:44 -0600 Subject: [PATCH] grub/err: Do compile-time format string checking on grub_error() This should help prevent format string errors and thus improve the quality of error reporting. Signed-off-by: Glenn Washburn Reviewed-by: Daniel Kiper --- include/grub/err.h | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/include/grub/err.h b/include/grub/err.h index 24ba9f5f5..b08d5d0de 100644 --- a/include/grub/err.h +++ b/include/grub/err.h @@ -85,7 +85,8 @@ struct grub_error_saved extern grub_err_t EXPORT_VAR(grub_errno); extern char EXPORT_VAR(grub_errmsg)[GRUB_MAX_ERRMSG]; -grub_err_t EXPORT_FUNC(grub_error) (grub_err_t n, const char *fmt, ...); +grub_err_t EXPORT_FUNC(grub_error) (grub_err_t n, const char *fmt, ...) + __attribute__ ((format (GNU_PRINTF, 2, 3))); void EXPORT_FUNC(grub_fatal) (const char *fmt, ...) __attribute__ ((noreturn)); void EXPORT_FUNC(grub_error_push) (void); int EXPORT_FUNC(grub_error_pop) (void);