Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

rtc: mc13xxx: fix obfuscated and wrong format string

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>
Signed-off-by: Alexandre Belloni <alexandre.belloni@free-electrons.com>

authored by

Rasmus Villemoes and committed by
Alexandre Belloni
99c14e4d 607b8fc9

+1 -1
+1 -1
drivers/rtc/rtc-mc13xxx.c
··· 216 216 217 217 s1970 = rtc_tm_to_time64(&alarm->time); 218 218 219 - dev_dbg(dev, "%s: o%2.s %lld\n", __func__, alarm->enabled ? "n" : "ff", 219 + dev_dbg(dev, "%s: %s %lld\n", __func__, alarm->enabled ? "on" : "off", 220 220 (long long)s1970); 221 221 222 222 ret = mc13xxx_rtc_irq_enable_unlocked(dev, alarm->enabled,