summaryrefslogtreecommitdiff
path: root/arch/loongarch
diff options
context:
space:
mode:
authorQing Zhang <zhangqing@loongson.cn>2023-06-15 09:35:52 +0300
committerHuacai Chen <chenhuacai@loongson.cn>2023-06-15 09:35:52 +0300
commit0246d0aaf0a634a65135050011767b56ba351a8f (patch)
tree57e52d63b8753cc185baabcdc3d3e158be1652ef /arch/loongarch
parent962369120d750cbc9c4dc492f32b4304669ff6aa (diff)
downloadlinux-0246d0aaf0a634a65135050011767b56ba351a8f.tar.xz
LoongArch: Avoid uninitialized alignment_mask
The hardware monitoring points for instruction fetching and load/store operations need to align 4 bytes and 1/2/4/8 bytes respectively. Reported-by: Colin King <colin.i.king@gmail.com> Signed-off-by: Qing Zhang <zhangqing@loongson.cn> Signed-off-by: Huacai Chen <chenhuacai@loongson.cn>
Diffstat (limited to 'arch/loongarch')
-rw-r--r--arch/loongarch/kernel/hw_breakpoint.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/arch/loongarch/kernel/hw_breakpoint.c b/arch/loongarch/kernel/hw_breakpoint.c
index 2406c95b34cc..021b59c248fa 100644
--- a/arch/loongarch/kernel/hw_breakpoint.c
+++ b/arch/loongarch/kernel/hw_breakpoint.c
@@ -396,6 +396,8 @@ int hw_breakpoint_arch_parse(struct perf_event *bp,
if (hw->ctrl.type != LOONGARCH_BREAKPOINT_EXECUTE)
alignment_mask = 0x7;
+ else
+ alignment_mask = 0x3;
offset = hw->address & alignment_mask;
hw->address &= ~alignment_mask;