[1/9] batman-adv: Annotate functions with format strings

Message ID 1305407694-16789-1-git-send-email-sven@narfation.org (mailing list archive)
State Accepted, archived
Commit 4560a6550c3613479e32a0c8816341b55a382967
Headers

Commit Message

Sven Eckelmann May 14, 2011, 9:14 p.m. UTC
  Signed-off-by: Sven Eckelmann <sven@narfation.org>
---
 bat_debugfs.c |    1 +
 main.h        |    3 ++-
 2 files changed, 3 insertions(+), 1 deletions(-)
  

Comments

Andrew Lunn May 15, 2011, 6:36 a.m. UTC | #1
Hi Sven

Nice set of patches.

Are you using any tools to find these issues? I don't think sparse
points these out.

       Thanks
  	Andrew
  
Sven Eckelmann May 15, 2011, 7:27 a.m. UTC | #2
Andrew Lunn wrote:
> Nice set of patches.
> 
> Are you using any tools to find these issues? I don't think sparse
> points these out.

I read the linux kernel mailinglist and found a mail where batman-ad was 
mentioned [1] - nothing to be proud of. So I started to look around and found 
something here and there... at the end I had bleeding eyes and 9 patches (yes, 
there are ten because I did a break and noticed too late that I wanted to add 
the sparse/lockdep annotation for the RCU update-side since a while).

Kind regards,
	Sven

[1] http://thread.gmane.org/gmane.linux.kernel/1139857
  
Marek Lindner May 18, 2011, 9:32 a.m. UTC | #3
On Saturday 14 May 2011 23:14:46 Sven Eckelmann wrote:
> Signed-off-by: Sven Eckelmann <sven@narfation.org>
> ---
>  bat_debugfs.c |    1 +
>  main.h        |    3 ++-
>  2 files changed, 3 insertions(+), 1 deletions(-)

Applied in revision 4560a65.

Thanks,
Marek
  
Marek Lindner May 19, 2011, 8:28 a.m. UTC | #4
On Sunday 15 May 2011 09:27:57 Sven Eckelmann wrote:
> I read the linux kernel mailinglist and found a mail where batman-ad was
> mentioned [1] - nothing to be proud of. So I started to look around and
> found something here and there... at the end I had bleeding eyes and 9
> patches (yes, there are ten because I did a break and noticed too late
> that I wanted to add the sparse/lockdep annotation for the RCU update-side
> since a while).

Please find somebody that can take a picture of you next time. I'd like to 
prepare a picture gallery of all the people who suffer to make batman-adv 
somewhat usable.  :-)

Thanks,
Marek
  

Patch

diff --git a/bat_debugfs.c b/bat_debugfs.c
index abaeec5..4577d3f 100644
--- a/bat_debugfs.c
+++ b/bat_debugfs.c
@@ -50,6 +50,7 @@  static void emit_log_char(struct debug_log *debug_log, char c)
 		debug_log->log_start = debug_log->log_end - log_buff_len;
 }
 
+__printf(2, 3)
 static int fdebug_log(struct debug_log *debug_log, char *fmt, ...)
 {
 	va_list args;
diff --git a/main.h b/main.h
index 3ca3941..f80954b 100644
--- a/main.h
+++ b/main.h
@@ -138,7 +138,7 @@  void dec_module_count(void);
 int is_my_mac(uint8_t *addr);
 
 #ifdef CONFIG_BATMAN_ADV_DEBUG
-int debug_log(struct bat_priv *bat_priv, char *fmt, ...);
+int debug_log(struct bat_priv *bat_priv, char *fmt, ...) __printf(2, 3);
 
 #define bat_dbg(type, bat_priv, fmt, arg...)			\
 	do {							\
@@ -147,6 +147,7 @@  int debug_log(struct bat_priv *bat_priv, char *fmt, ...);
 	}							\
 	while (0)
 #else /* !CONFIG_BATMAN_ADV_DEBUG */
+__printf(3, 4)
 static inline void bat_dbg(char type __always_unused,
 			   struct bat_priv *bat_priv __always_unused,
 			   char *fmt __always_unused, ...)