[PATCH AUTOSEL 5.15 12/16] scsi: st: Fix array overflow in st_setup()
From: Sasha Levin
Date: Thu Apr 03 2025 - 16:01:21 EST
From: Kai Mäkisara <Kai.Makisara@xxxxxxxxxxx>
[ Upstream commit a018d1cf990d0c339fe0e29b762ea5dc10567d67 ]
Change the array size to follow parms size instead of a fixed value.
Reported-by: Chenyuan Yang <chenyuan0y@xxxxxxxxx>
Closes: https://lore.kernel.org/linux-scsi/CALGdzuoubbra4xKOJcsyThdk5Y1BrAmZs==wbqjbkAgmKS39Aw@xxxxxxxxxxxxxx/
Signed-off-by: Kai Mäkisara <Kai.Makisara@xxxxxxxxxxx>
Link: https://lore.kernel.org/r/20250311112516.5548-2-Kai.Makisara@xxxxxxxxxxx
Signed-off-by: Martin K. Petersen <martin.petersen@xxxxxxxxxx>
Signed-off-by: Sasha Levin <sashal@xxxxxxxxxx>
---
drivers/scsi/st.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/scsi/st.c b/drivers/scsi/st.c
index 1551d533c7196..956b3b9c5aad5 100644
--- a/drivers/scsi/st.c
+++ b/drivers/scsi/st.c
@@ -4109,7 +4109,7 @@ static void validate_options(void)
*/
static int __init st_setup(char *str)
{
- int i, len, ints[5];
+ int i, len, ints[ARRAY_SIZE(parms) + 1];
char *stp;
stp = get_options(str, ARRAY_SIZE(ints), ints);
--
2.39.5