Patch "soc: qcom: socinfo: Fix an off by one in qcom_show_pmic_model()" has been added to the 5.10-stable tree

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



This is a note to let you know that I've just added the patch titled

    soc: qcom: socinfo: Fix an off by one in qcom_show_pmic_model()

to the 5.10-stable tree which can be found at:
    http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary

The filename of the patch is:
     soc-qcom-socinfo-fix-an-off-by-one-in-qcom_show_pmic.patch
and it can be found in the queue-5.10 subdirectory.

If you, or anyone else, feels it should not be added to the stable tree,
please let <stable@xxxxxxxxxxxxxxx> know about it.



commit 84833c3fd8c5be6f03ca6fe3b695dd9332857a31
Author: Dan Carpenter <dan.carpenter@xxxxxxxxxx>
Date:   Wed Jan 20 12:57:55 2021 +0300

    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@xxxxxxxxxx>
    Reviewed-by: Douglas Anderson <dianders@xxxxxxxxxxxx>
    Reviewed-by: Stephen Boyd <swboyd@xxxxxxxxxxxx>
    Fixes: e9247e2ce577 ("soc: qcom: socinfo: fix printing of pmic_model")
    Signed-off-by: Dan Carpenter <dan.carpenter@xxxxxxxxxx>
    Link: https://lore.kernel.org/r/YAf+o85Z9lgkq3Nw@mwanda
    Signed-off-by: Bjorn Andersson <bjorn.andersson@xxxxxxxxxx>
    Signed-off-by: Sasha Levin <sashal@xxxxxxxxxx>

diff --git a/drivers/soc/qcom/socinfo.c b/drivers/soc/qcom/socinfo.c
index b44ede48decc0..e0620416e5743 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);



[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux