Skip to content

Commit d0aa6fc

Browse files
nashifdleach02
authored andcommitted
drivers: kscan_mchp_xec: fix memory corruption
Fixes memory corruption (Out-of-bounds write ) case discovered by coverity. Fixes #20494 Coverity CID: 205617 Signed-off-by: Anas Nashif <[email protected]>
1 parent 1968165 commit d0aa6fc

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

drivers/kscan/kscan_mchp_xec.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -157,7 +157,7 @@ static bool check_key_events(void *dev)
157157
bool key_pressed = false;
158158
u32_t cycles_now = k_cycle_get_32();
159159

160-
if (++kbd_data.scan_cycles_idx > SCAN_OCURRENCES)
160+
if (++kbd_data.scan_cycles_idx >= SCAN_OCURRENCES)
161161
kbd_data.scan_cycles_idx = 0U;
162162

163163
kbd_data.scan_clk_cycle[kbd_data.scan_cycles_idx] = cycles_now;

0 commit comments

Comments
 (0)