Re: [PATCH 2/4] soc: qcom: socinfo: fix printing of pmic_model

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

 



On Mon 25 May 09:48 PDT 2020, Dmitry Baryshkov wrote:

> Print sensible string instead of just "(null)" for unknown PMIC models.
> Also as we are at it, do not let debugfs handler access past pmic_models
> array.
> 

Reviewed-by: Bjorn Andersson <bjorn.andersson@xxxxxxxxxx>

Regards,
Bjorn

> Signed-off-by: Dmitry Baryshkov <dmitry.baryshkov@xxxxxxxxxx>
> ---
>  drivers/soc/qcom/socinfo.c | 5 ++++-
>  1 file changed, 4 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/soc/qcom/socinfo.c b/drivers/soc/qcom/socinfo.c
> index 0e6adf1161c0..41f48c3447cc 100644
> --- a/drivers/soc/qcom/socinfo.c
> +++ b/drivers/soc/qcom/socinfo.c
> @@ -269,7 +269,10 @@ static int qcom_show_pmic_model(struct seq_file *seq, void *p)
>  	if (model < 0)
>  		return -EINVAL;
>  
> -	seq_printf(seq, "%s\n", 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);
>  
>  	return 0;
>  }
> -- 
> 2.26.2
> 



[Index of Archives]     [Linux ARM Kernel]     [Linux ARM]     [Linux Omap]     [Fedora ARM]     [Linux for Sparc]     [IETF Annouce]     [Security]     [Bugtraq]     [Linux MIPS]     [ECOS]     [Asterisk Internet PBX]     [Linux API]

  Powered by Linux