diff options
author | Stefan Raspl <raspl@linux.vnet.ibm.com> | 2013-03-05 04:39:55 -0500 |
---|---|---|
committer | Martin Schwidefsky <schwidefsky@de.ibm.com> | 2013-04-17 08:07:25 -0400 |
commit | 0bcc94baca601c266ded6347c614b180316a383c (patch) | |
tree | 168167a6435d46acf4411dc24997c59bd23f204a | |
parent | 08b421245692f3d10f010f02dae69df6a305271c (diff) |
s390/dis: use explicit buf len
Pass buffer length in extra parameter.
Signed-off-by: Stefan Raspl <raspl@linux.vnet.ibm.com>
Reviewed-by: Heiko Carstens <heiko.carstens@de.ibm.com>
Signed-off-by: Martin Schwidefsky <schwidefsky@de.ibm.com>
-rw-r--r-- | arch/s390/include/asm/processor.h | 3 | ||||
-rw-r--r-- | arch/s390/kernel/dis.c | 9 | ||||
-rw-r--r-- | arch/s390/kvm/trace.h | 2 |
3 files changed, 8 insertions, 6 deletions
diff --git a/arch/s390/include/asm/processor.h b/arch/s390/include/asm/processor.h index 94e749c90230..6b499870662f 100644 --- a/arch/s390/include/asm/processor.h +++ b/arch/s390/include/asm/processor.h | |||
@@ -161,7 +161,8 @@ extern unsigned long thread_saved_pc(struct task_struct *t); | |||
161 | 161 | ||
162 | extern void show_code(struct pt_regs *regs); | 162 | extern void show_code(struct pt_regs *regs); |
163 | extern void print_fn_code(unsigned char *code, unsigned long len); | 163 | extern void print_fn_code(unsigned char *code, unsigned long len); |
164 | extern int insn_to_mnemonic(unsigned char *instruction, char buf[8]); | 164 | extern int insn_to_mnemonic(unsigned char *instruction, char *buf, |
165 | unsigned int len); | ||
165 | 166 | ||
166 | unsigned long get_wchan(struct task_struct *p); | 167 | unsigned long get_wchan(struct task_struct *p); |
167 | #define task_pt_regs(tsk) ((struct pt_regs *) \ | 168 | #define task_pt_regs(tsk) ((struct pt_regs *) \ |
diff --git a/arch/s390/kernel/dis.c b/arch/s390/kernel/dis.c index 3ad5e9540160..7f4a4a8c847c 100644 --- a/arch/s390/kernel/dis.c +++ b/arch/s390/kernel/dis.c | |||
@@ -1696,14 +1696,15 @@ static struct insn *find_insn(unsigned char *code) | |||
1696 | * insn_to_mnemonic - decode an s390 instruction | 1696 | * insn_to_mnemonic - decode an s390 instruction |
1697 | * @instruction: instruction to decode | 1697 | * @instruction: instruction to decode |
1698 | * @buf: buffer to fill with mnemonic | 1698 | * @buf: buffer to fill with mnemonic |
1699 | * @len: length of buffer | ||
1699 | * | 1700 | * |
1700 | * Decode the instruction at @instruction and store the corresponding | 1701 | * Decode the instruction at @instruction and store the corresponding |
1701 | * mnemonic into @buf. | 1702 | * mnemonic into @buf of length @len. |
1702 | * @buf is left unchanged if the instruction could not be decoded. | 1703 | * @buf is left unchanged if the instruction could not be decoded. |
1703 | * Returns: | 1704 | * Returns: |
1704 | * %0 on success, %-ENOENT if the instruction was not found. | 1705 | * %0 on success, %-ENOENT if the instruction was not found. |
1705 | */ | 1706 | */ |
1706 | int insn_to_mnemonic(unsigned char *instruction, char buf[8]) | 1707 | int insn_to_mnemonic(unsigned char *instruction, char *buf, unsigned int len) |
1707 | { | 1708 | { |
1708 | struct insn *insn; | 1709 | struct insn *insn; |
1709 | 1710 | ||
@@ -1711,10 +1712,10 @@ int insn_to_mnemonic(unsigned char *instruction, char buf[8]) | |||
1711 | if (!insn) | 1712 | if (!insn) |
1712 | return -ENOENT; | 1713 | return -ENOENT; |
1713 | if (insn->name[0] == '\0') | 1714 | if (insn->name[0] == '\0') |
1714 | snprintf(buf, 8, "%s", | 1715 | snprintf(buf, len, "%s", |
1715 | long_insn_name[(int) insn->name[1]]); | 1716 | long_insn_name[(int) insn->name[1]]); |
1716 | else | 1717 | else |
1717 | snprintf(buf, 8, "%.5s", insn->name); | 1718 | snprintf(buf, len, "%.5s", insn->name); |
1718 | return 0; | 1719 | return 0; |
1719 | } | 1720 | } |
1720 | EXPORT_SYMBOL_GPL(insn_to_mnemonic); | 1721 | EXPORT_SYMBOL_GPL(insn_to_mnemonic); |
diff --git a/arch/s390/kvm/trace.h b/arch/s390/kvm/trace.h index 2b29e62351d3..53252d2d4720 100644 --- a/arch/s390/kvm/trace.h +++ b/arch/s390/kvm/trace.h | |||
@@ -117,7 +117,7 @@ TRACE_EVENT(kvm_s390_intercept_instruction, | |||
117 | __entry->instruction, | 117 | __entry->instruction, |
118 | insn_to_mnemonic((unsigned char *) | 118 | insn_to_mnemonic((unsigned char *) |
119 | &__entry->instruction, | 119 | &__entry->instruction, |
120 | __entry->insn) ? | 120 | __entry->insn, sizeof(__entry->insn)) ? |
121 | "unknown" : __entry->insn) | 121 | "unknown" : __entry->insn) |
122 | ); | 122 | ); |
123 | 123 | ||