From: Glenn Washburn Date: Fri, 5 Mar 2021 00:22:44 +0000 (-0600) Subject: grub/err: Do compile-time format string checking on grub_error() X-Git-Tag: grub-2.06-rc1~3 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=57236f2dd93c0451e68aa9231eb4514c45218804;p=thirdparty%2Fgrub.git 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 --- 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);