Skip to content

Commit db04986

Browse files
Michal WilczynskiJassi Brar
authored andcommitted
mailbox: th1520: Fix memory corruption due to incorrect array size
The functions th1520_mbox_suspend_noirq and th1520_mbox_resume_noirq are intended to save and restore the interrupt mask registers in the MBOX ICU0. However, the array used to store these registers was incorrectly sized, leading to memory corruption when accessing all four registers. This commit corrects the array size to accommodate all four interrupt mask registers, preventing memory corruption during suspend and resume operations. Fixes: 5d4d263 ("mailbox: Introduce support for T-head TH1520 Mailbox driver") Reported-by: Dan Carpenter <dan.carpenter@linaro.org> Closes: https://lore.kernel.org/all/a99e72be-8490-4960-ad26-cbfef6af238f@stanley.mountain/ Signed-off-by: Michal Wilczynski <m.wilczynski@samsung.com> Signed-off-by: Jassi Brar <jassisinghbrar@gmail.com>
1 parent 170a264 commit db04986

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

drivers/mailbox/mailbox-th1520.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@
4141
#ifdef CONFIG_PM_SLEEP
4242
/* store MBOX context across system-wide suspend/resume transitions */
4343
struct th1520_mbox_context {
44-
u32 intr_mask[TH_1520_MBOX_CHANS - 1];
44+
u32 intr_mask[TH_1520_MBOX_CHANS];
4545
};
4646
#endif
4747

0 commit comments

Comments
 (0)