diff options
author | Dan Carpenter <dan.carpenter@oracle.com> | 2021-01-20 12:57:55 +0300 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2021-03-04 11:37:24 +0100 |
commit | 6e46b23a9f4c00255eaf77b03a039615edc95676 (patch) | |
tree | 3fbe1351b97c2d608f73af077316c048a665cc58 /drivers/soc | |
parent | 4cbd11f9c37ecb43ee90b5e6aa4114647314d2bd (diff) | |
download | linux-stable-6e46b23a9f4c00255eaf77b03a039615edc95676.tar.gz linux-stable-6e46b23a9f4c00255eaf77b03a039615edc95676.tar.bz2 linux-stable-6e46b23a9f4c00255eaf77b03a039615edc95676.zip |
soc: qcom: socinfo: Fix an off by one in qcom_show_pmic_model()
[ Upstream commit 5fb33d8960dc7abdabc6fe599a30c2c99b082ef6 ]
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: e9247e2ce577 ("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>
Diffstat (limited to 'drivers/soc')
-rw-r--r-- | drivers/soc/qcom/socinfo.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/drivers/soc/qcom/socinfo.c b/drivers/soc/qcom/socinfo.c index b44ede48decc..e0620416e574 100644 --- a/drivers/soc/qcom/socinfo.c +++ b/drivers/soc/qcom/socinfo.c @@ -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); |