mirror of
https://github.com/torvalds/linux.git
synced 2026-06-07 14:04:54 +02:00
soc: qcom: socinfo: Fix an off by one in qcom_show_pmic_model()
[ Upstream commit5fb33d8960] These need to be < ARRAY_SIZE() instead of <= ARRAY_SIZE() to prevent accessing one element beyond the end of the array. Acked-by: Dmitry Baryshkov <dmitry.baryshkov@linaro.org> Reviewed-by: Douglas Anderson <dianders@chromium.org> Reviewed-by: Stephen Boyd <swboyd@chromium.org> Fixes:e9247e2ce5("soc: qcom: socinfo: fix printing of pmic_model") Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com> Link: https://lore.kernel.org/r/YAf+o85Z9lgkq3Nw@mwanda Signed-off-by: Bjorn Andersson <bjorn.andersson@linaro.org> Signed-off-by: Sasha Levin <sashal@kernel.org>
This commit is contained in:
parent
4cbd11f9c3
commit
6e46b23a9f
|
|
@ -280,7 +280,7 @@ static int qcom_show_pmic_model(struct seq_file *seq, void *p)
|
|||
if (model < 0)
|
||||
return -EINVAL;
|
||||
|
||||
if (model <= ARRAY_SIZE(pmic_models) && pmic_models[model])
|
||||
if (model < ARRAY_SIZE(pmic_models) && pmic_models[model])
|
||||
seq_printf(seq, "%s\n", pmic_models[model]);
|
||||
else
|
||||
seq_printf(seq, "unknown (%d)\n", model);
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user