log: Check printf() arguments
authorSimon Glass <sjg@chromium.org>
Mon, 7 Jan 2019 23:44:19 +0000 (16:44 -0700)
committerSimon Glass <sjg@chromium.org>
Tue, 15 Jan 2019 00:47:13 +0000 (17:47 -0700)
At present logging does not check printf() arguments. Now that all users
have been corrected, enable this to prevent further problems.

Signed-off-by: Simon Glass <sjg@chromium.org>
include/log.h

index 0f2bc19..d7f6471 100644 (file)
@@ -73,7 +73,8 @@ static inline int log_uc_cat(enum uclass_id id)
  * @return 0 if log record was emitted, -ve on error
  */
 int _log(enum log_category_t cat, enum log_level_t level, const char *file,
-        int line, const char *func, const char *fmt, ...);
+        int line, const char *func, const char *fmt, ...)
+               __attribute__ ((format (__printf__, 6, 7)));
 
 /* Define this at the top of a file to add a prefix to debug messages */
 #ifndef pr_fmt