]> git.ipfire.org Git - thirdparty/kernel/stable.git/commit
s390/dis: Fix handling of format specifiers
authorMichael Holzheu <holzheu@linux.vnet.ibm.com>
Thu, 17 Dec 2015 18:06:02 +0000 (19:06 +0100)
committerWilly Tarreau <w@1wt.eu>
Fri, 29 Jan 2016 21:12:54 +0000 (22:12 +0100)
commit22a1caa0c96e94e710fcf2a9a01fdd3f091a7171
treee7be3f75ff317d2eac3b94c4609cc043a9feea8f
parent2bafc5d56fdfebb9e74a9c6f2e50033498b7b424
s390/dis: Fix handling of format specifiers

commit 272fa59ccb4fc802af28b1d699c2463db6a71bf7 upstream.

The print_insn() function returns strings like "lghi %r1,0". To escape the
'%' character in sprintf() a second '%' is used. For example "lghi %%r1,0"
is converted into "lghi %r1,0".

After print_insn() the output string is passed to printk(). Because format
specifiers like "%r" or "%f" are ignored by printk() this works by chance
most of the time. But for instructions with control registers like
"lctl %c6,%c6,780" this fails because printk() interprets "%c" as
character format specifier.

Fix this problem and escape the '%' characters twice.

For example "lctl %%%%c6,%%%%c6,780" is then converted by sprintf()
into "lctl %%c6,%%c6,780" and by printk() into "lctl %c6,%c6,780".

Signed-off-by: Michael Holzheu <holzheu@linux.vnet.ibm.com>
Signed-off-by: Martin Schwidefsky <schwidefsky@de.ibm.com>
[bwh: Backported to 3.2: drop the OPERAND_VR case]
Signed-off-by: Ben Hutchings <ben@decadent.org.uk>
(cherry picked from commit 45f32e359d36dd045e4af0d1bea8bbbafd81eeb7)
Signed-off-by: Willy Tarreau <w@1wt.eu>
arch/s390/kernel/dis.c