* re: LoongArch: Add hardware breakpoints/watchpoints support
@ 2023-06-08 7:47 Colin King (gmail)
0 siblings, 0 replies; only message in thread
From: Colin King (gmail) @ 2023-06-08 7:47 UTC (permalink / raw)
To: Qing Zhang, loongarch; +Cc: Huacai Chen, WANG Xuerui, linux-kernel
Hi,
Static analysis with cppcheck has found an issue in
arch/loongarch/kernel/hw_breakpoint.c function hw_breakpoint_arch_parse
with the following commit:
commit edffa33c7bb5a73e90c754c7a497162b77d7c55f
Author: Qing Zhang <zhangqing@loongson.cn>
Date: Sat Feb 25 15:52:57 2023 +0800
LoongArch: Add hardware breakpoints/watchpoints support
/*
* Validate the arch-specific HW Breakpoint register settings.
*/
int hw_breakpoint_arch_parse(struct perf_event *bp,
const struct perf_event_attr *attr,
struct arch_hw_breakpoint *hw)
{
int ret;
u64 alignment_mask, offset;
^^ alignment mask is not initialized
/* Build the arch_hw_breakpoint. */
ret = arch_build_bp_info(bp, attr, hw);
if (ret)
return ret;
if (hw->ctrl.type != LOONGARCH_BREAKPOINT_EXECUTE)
alignment_mask = 0x7;
^^ only on this if path is alignment_mask being assigned
offset = hw->address & alignment_mask;
hw->address &= ~alignment_mask;
^^ offset and hw->address being modified by potentially uninitialized
alignment_mask
hw->ctrl.len <<= offset;
return 0;
}
Regards,
Colin
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2023-06-08 7:47 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-06-08 7:47 LoongArch: Add hardware breakpoints/watchpoints support Colin King (gmail)
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.