public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] rtc: mc13xxx: fix obfuscated and wrong format string
@ 2015-02-20 13:47 Rasmus Villemoes
  2015-05-11  7:26 ` Alexandre Belloni
  0 siblings, 1 reply; 2+ messages in thread
From: Rasmus Villemoes @ 2015-02-20 13:47 UTC (permalink / raw)
  To: Alessandro Zummo; +Cc: Rasmus Villemoes, rtc-linux, linux-kernel

According to C99, %2.s means 'print two spaces' (a precision of
. without following digits or * means 0). The kernel's printf
implementation, however, treats that case as if no precision was
given, but relying on that quirk is rather silly. Also, since no -
(aka left-justify) flag is given, the field with of 2 would then cause
the alarm->enabled case to come out as "o n". Deobfuscate it.

Signed-off-by: Rasmus Villemoes <linux@rasmusvillemoes.dk>
---
 drivers/rtc/rtc-mc13xxx.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/rtc/rtc-mc13xxx.c b/drivers/rtc/rtc-mc13xxx.c
index 5bce904b7ee6..c8e78a560de7 100644
--- a/drivers/rtc/rtc-mc13xxx.c
+++ b/drivers/rtc/rtc-mc13xxx.c
@@ -219,7 +219,7 @@ static int mc13xxx_rtc_set_alarm(struct device *dev, struct rtc_wkalrm *alarm)
 	if (unlikely(ret))
 		goto out;
 
-	dev_dbg(dev, "%s: o%2.s %lu\n", __func__, alarm->enabled ? "n" : "ff",
+	dev_dbg(dev, "%s: %s %lu\n", __func__, alarm->enabled ? "on" : "off",
 			s1970);
 
 	ret = mc13xxx_rtc_irq_enable_unlocked(dev, alarm->enabled,
-- 
2.1.3


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: rtc: mc13xxx: fix obfuscated and wrong format string
  2015-02-20 13:47 [PATCH] rtc: mc13xxx: fix obfuscated and wrong format string Rasmus Villemoes
@ 2015-05-11  7:26 ` Alexandre Belloni
  0 siblings, 0 replies; 2+ messages in thread
From: Alexandre Belloni @ 2015-05-11  7:26 UTC (permalink / raw)
  To: Rasmus Villemoes; +Cc: Alessandro Zummo, rtc-linux, linux-kernel

On 20/02/2015 at 14:47:30 +0100, Rasmus Villemoes wrote :
> According to C99, %2.s means 'print two spaces' (a precision of
> . without following digits or * means 0). The kernel's printf
> implementation, however, treats that case as if no precision was
> given, but relying on that quirk is rather silly. Also, since no -
> (aka left-justify) flag is given, the field with of 2 would then cause
> the alarm->enabled case to come out as "o n". Deobfuscate it.
> 
> Signed-off-by: Rasmus Villemoes <linux@rasmusvillemoes.dk>
> ---
>  drivers/rtc/rtc-mc13xxx.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 

Rebased and applied on rtc-next, thanks.


-- 
Alexandre Belloni, Free Electrons
Embedded Linux, Kernel and Android engineering
http://free-electrons.com

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2015-05-11  7:26 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-02-20 13:47 [PATCH] rtc: mc13xxx: fix obfuscated and wrong format string Rasmus Villemoes
2015-05-11  7:26 ` Alexandre Belloni

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox