Hi Hagio-san,
kernel.c:11623:7: warning: format not a string literal and no format
arguments
[-Wformat-security]
fprintf(fp, space(PRINTK_SAFE_SEQ_BUF_INDENT));
^~~~~~~
I should have checked the warning.
Thank you for your review and your additional fix.
Thanks,
Shogo Matsumoto
-----Original Message-----
> > This patch set introduces -s option for log builtin command to display
> > printk safe buffers (safe_print_seq/nmi_print_seq) as follows:
> >
> > ===
> > crash> log -s
> > PRINTK_SAFE_SEQ_BUF: nmi_print_seq
> > CPU: 0 ADDR: ffff969d7bc19ce0 LEN: 150 MESSAGE_LOST: 0
> > Uhhuh. NMI received for unknown reason 20 on CPU 0.
> > Do you have a strange power saving mode enabled?
> > Dazed and confused, but trying to continue
> > ...
> > ===
> >
> > The printk safe buffers are also displayed at the bottom of
> > 'log' output so as not to overlook them.
> >
> > ===
> > crash> log
> > ...
> > [nmi_print_seq] Uhhuh. NMI received for unknown reason 20 on CPU 0.
> > [nmi_print_seq] Do you have a strange power saving mode enabled?
> > [nmi_print_seq] Dazed and confused, but trying to continue
> > ===
> >
> > -m and -t options are also supported.
> >
> > Note that the safe buffer (struct printk_safe_seq_buf) was introduced
> > in kernel-4.11 (Merge commit 7d91de74436a69c2b78a7a72f1e7f97f8b4396fa)
> > and removed in kernel-5.15 (93d102f094be9beab28e5afb656c188b16a3793b).
> >
> > Changes since v2:
> > - Add support new options -s, -t, -m (Kazu)
> > - Add help text (Kazu)
>
> Thank you for the update.
>
> Maybe I will join the patches into two or three and the following warning
> is emitted, so I will adjust a little when merging, but otherwise the
> patchset and the output of the commands look nice to me!
>
> Acked-by: Kazuhito Hagio <k-hagio-ab(a)nec.com>
>
>
> $ make clean ; make warn
> ...
> cc -c -g -DX86_64 -DLZO -DSNAPPY -DGDB_10_2 kernel.c -Wall -O2
> -Wstrict-prototypes -Wmissing-prototypes -fstack-protector -Wformat-security
> kernel.c: In function ‘__dump_printk_safe_seq_buf’:
kernel.c:11623:7: warning: format not a string literal and no format
arguments
[-Wformat-security]
fprintf(fp, space(PRINTK_SAFE_SEQ_BUF_INDENT));
^~~~~~~
>
> Will add "%s".
>
> Thanks,
> Kazu
>
> >
> > [v1]:
>
https://listman.redhat.com/archives/crash-utility/2021-December/msg00031.ht
> ml
> > [v2]:
>
https://listman.redhat.com/archives/crash-utility/2022-January/msg00004.html
> >
> > Test program is attached in the above v2 patch e-mail.
> >
> > Shogo Matsumoto (7):
> > log: introduce -s option
> > log: adjust indent and line breaks for log -s
> > log: append printk safe buffer output to 'log'
> > log: add support -t option for output of printk safe buffers
> > log: add support -m for output of printk safe buffers
> > symbols: add support 'help -o' for printk safe buffers
> > log: add help text for printk safe buffers
> >
> > defs.h | 5 ++
> > help.c | 25 ++++++++-
> > kernel.c | 159
> +++++++++++++++++++++++++++++++++++++++++++++++++++
> ++-
> > symbols.c | 5 ++
> > 4 files changed, 192 insertions(+), 2 deletions(-)
> >
> > --
> > 2.29.2
> >
> >
> > --
> > Crash-utility mailing list
> > Crash-utility(a)redhat.com
> >
https://listman.redhat.com/mailman/listinfo/crash-utility