Skip to content

Commit 76ffa72

Browse files
Peter ZijlstraIngo Molnar
authored andcommitted
x86/alternatives: Use INT3_INSN_SIZE
Use INT3_INSN_SIZE instead of sizeof(int3). Suggested-by: Ingo Molnar <mingo@kernel.org> Tested-by: Alexei Starovoitov <ast@kernel.org> Tested-by: Steven Rostedt (VMware) <rostedt@goodmis.org> Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org> Acked-by: Alexei Starovoitov <ast@kernel.org> Cc: Andy Lutomirski <luto@kernel.org> Cc: Borislav Petkov <bp@alien8.de> Cc: Brian Gerst <brgerst@gmail.com> Cc: Denys Vlasenko <dvlasenk@redhat.com> Cc: H. Peter Anvin <hpa@zytor.com> Cc: Linus Torvalds <torvalds@linux-foundation.org> Cc: Peter Zijlstra <peterz@infradead.org> Cc: Thomas Gleixner <tglx@linutronix.de> Link: https://lkml.kernel.org/r/20191111132458.460144656@infradead.org Signed-off-by: Ingo Molnar <mingo@kernel.org>
1 parent f2cb4f9 commit 76ffa72

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

arch/x86/kernel/alternative.c

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1088,7 +1088,7 @@ static void text_poke_bp_batch(struct text_poke_loc *tp, unsigned int nr_entries
10881088
* First step: add a int3 trap to the address that will be patched.
10891089
*/
10901090
for (i = 0; i < nr_entries; i++)
1091-
text_poke(text_poke_addr(&tp[i]), &int3, sizeof(int3));
1091+
text_poke(text_poke_addr(&tp[i]), &int3, INT3_INSN_SIZE);
10921092

10931093
text_poke_sync();
10941094

@@ -1098,10 +1098,10 @@ static void text_poke_bp_batch(struct text_poke_loc *tp, unsigned int nr_entries
10981098
for (do_sync = 0, i = 0; i < nr_entries; i++) {
10991099
int len = text_opcode_size(tp[i].opcode);
11001100

1101-
if (len - sizeof(int3) > 0) {
1102-
text_poke(text_poke_addr(&tp[i]) + sizeof(int3),
1103-
(const char *)tp[i].text + sizeof(int3),
1104-
len - sizeof(int3));
1101+
if (len - INT3_INSN_SIZE > 0) {
1102+
text_poke(text_poke_addr(&tp[i]) + INT3_INSN_SIZE,
1103+
(const char *)tp[i].text + INT3_INSN_SIZE,
1104+
len - INT3_INSN_SIZE);
11051105
do_sync++;
11061106
}
11071107
}
@@ -1123,7 +1123,7 @@ static void text_poke_bp_batch(struct text_poke_loc *tp, unsigned int nr_entries
11231123
if (tp[i].text[0] == INT3_INSN_OPCODE)
11241124
continue;
11251125

1126-
text_poke(text_poke_addr(&tp[i]), tp[i].text, sizeof(int3));
1126+
text_poke(text_poke_addr(&tp[i]), tp[i].text, INT3_INSN_SIZE);
11271127
do_sync++;
11281128
}
11291129

0 commit comments

Comments
 (0)