Skip to contentSkip to conversation

rtlwifi: btcoexist: avoid format string in printk

PATCH RESEND In review Kees Cook 2 participants 3 messages Jun 30, 2014 – Jul 1, 2014

Subsystems (3)
lore
Share & tools
lore

Kees Cook

author
#0 lore raw

PATCH RESEND 1/1 rtlwifi: btcoexist: avoid format string in printk

Since CL_PRINTF only ever takes a single argument, make sure a format string cannot leak into printk.

---
 .../net/wireless/rtlwifi/btcoexist/halbtcoutsrc.h  |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/wireless/rtlwifi/btcoexist/halbtcoutsrc.h +1 -1
index 871fc3c6d559..049f4c8d98a8 100644
@@ -114,7 +114,7 @@ extern u32 btc_dbg_type[];
 
 
 #define	CL_SPRINTF	snprintf
-#define	CL_PRINTF	printk
+#define	CL_PRINTF(buf)	printk("%s", buf)
 
 #define	BTC_PRINT(dbgtype, dbgflag, printstr, ...)		\
 	do {							\
Signature · 6 lines
1.7.9.5


-- 
Kees Cook
Chrome OS Security
#1 lore raw

Please look in the git trees before reposting patches...

commit 6437f51ec36af8ef1e3e2659439b35c37e5498e2

Author: Kees Cook <[email protected]>
Date:   Tue Jun 10 10:37:24 2014 -0700

rtlwifi: btcoexist: avoid format string in printk

Since CL_PRINTF only ever takes a single argument, make sure a format string cannot leak into printk.

Quoted 29 lines · Kees Cook

Since CL_PRINTF only ever takes a single argument, make sure a format string cannot leak into printk.

---
 .../net/wireless/rtlwifi/btcoexist/halbtcoutsrc.h  |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/wireless/rtlwifi/btcoexist/halbtcoutsrc.h +1 -1
index 871fc3c6d559..049f4c8d98a8 100644
@@ -114,7 +114,7 @@ extern u32 btc_dbg_type[];
 
 
 #define	CL_SPRINTF	snprintf
-#define	CL_PRINTF	printk
+#define	CL_PRINTF(buf)	printk("%s", buf)
 
 #define	BTC_PRINT(dbgtype, dbgflag, printstr, ...)		\
 	do {							\
Signature · 6 lines
1.7.9.5


-- 
Kees Cook
Chrome OS Security
Signature · 2 lines
John W. Linville		Someday the world will need a hero, and you
[email protected]			might be all we have.  Be ready.
author
#2 lore raw
Quoted 6 lines · John W. Linville

Please look in the git trees before reposting patches...

commit 6437f51ec36af8ef1e3e2659439b35c37e5498e2

Author: Kees Cook <[email protected]>
Date:   Tue Jun 10 10:37:24 2014 -0700
Quoted 7 lines

rtlwifi: btcoexist: avoid format string in printk

Since CL_PRINTF only ever takes a single argument, make sure a format string cannot leak into printk.

Ah! Thanks very much. I hadn't gotten any email about it getting applied, so I incorrectly assumed it hadn't been. :)

-Kees

Quoted 35 lines · Kees Cook
Quoted 25 lines

Since CL_PRINTF only ever takes a single argument, make sure a format string cannot leak into printk.

---
 .../net/wireless/rtlwifi/btcoexist/halbtcoutsrc.h  |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/wireless/rtlwifi/btcoexist/halbtcoutsrc.h +1 -2
index 871fc3c6d559..049f4c8d98a8 100644
@@ -114,7 +114,7 @@ extern u32 btc_dbg_type[];
 
 
 #define      CL_SPRINTF      snprintf
-#define      CL_PRINTF       printk
+#define      CL_PRINTF(buf)  printk("%s", buf)
 
 #define      BTC_PRINT(dbgtype, dbgflag, printstr, ...)              \
      do {                                                    \
--

1.7.9.5

Quoted 4 lines

--
Kees Cook
Chrome OS Security

--
John W. Linville Someday the world will need a hero, and you
[email protected] might be all we have. Be ready.

Signature · 2 lines
Kees Cook
Chrome OS Security