diff mbox series

media: camss: csid: fix wrong size passed to devm_kmalloc_array()

Message ID 20220509140439.1361352-1-yangyingliang@huawei.com (mailing list archive)
State New, archived
Headers show
Series media: camss: csid: fix wrong size passed to devm_kmalloc_array() | expand

Commit Message

Yang Yingliang May 9, 2022, 2:04 p.m. UTC
'supplies' is a pointer, the real size of struct regulator_bulk_data
should be pass to devm_kmalloc_array().

Fixes: 0d8140179715 ("media: camss: Add regulator_bulk support")
Signed-off-by: Yang Yingliang <yangyingliang@huawei.com>
---
 drivers/media/platform/qcom/camss/camss-csid.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Yang Yingliang May 10, 2022, 1:19 a.m. UTC | #1
I made a mistake, this patch was sent twice, please ignore this patch.

Thanks,
Yang
On 2022/5/9 22:04, Yang Yingliang wrote:
> 'supplies' is a pointer, the real size of struct regulator_bulk_data
> should be pass to devm_kmalloc_array().
>
> Fixes: 0d8140179715 ("media: camss: Add regulator_bulk support")
> Signed-off-by: Yang Yingliang <yangyingliang@huawei.com>
> ---
>   drivers/media/platform/qcom/camss/camss-csid.c | 2 +-
>   1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/media/platform/qcom/camss/camss-csid.c b/drivers/media/platform/qcom/camss/camss-csid.c
> index f993f349b66b..80628801cf09 100644
> --- a/drivers/media/platform/qcom/camss/camss-csid.c
> +++ b/drivers/media/platform/qcom/camss/camss-csid.c
> @@ -666,7 +666,7 @@ int msm_csid_subdev_init(struct camss *camss, struct csid_device *csid,
>   	if (csid->num_supplies) {
>   		csid->supplies = devm_kmalloc_array(camss->dev,
>   						    csid->num_supplies,
> -						    sizeof(csid->supplies),
> +						    sizeof(*csid->supplies),
>   						    GFP_KERNEL);
>   		if (!csid->supplies)
>   			return -ENOMEM;
Robert Foss May 16, 2022, 2:43 p.m. UTC | #2
On Mon, 9 May 2022 at 15:53, Yang Yingliang <yangyingliang@huawei.com> wrote:
>
> 'supplies' is a pointer, the real size of struct regulator_bulk_data
> should be pass to devm_kmalloc_array().
>
> Fixes: 0d8140179715 ("media: camss: Add regulator_bulk support")
> Signed-off-by: Yang Yingliang <yangyingliang@huawei.com>
> ---
>  drivers/media/platform/qcom/camss/camss-csid.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/media/platform/qcom/camss/camss-csid.c b/drivers/media/platform/qcom/camss/camss-csid.c
> index f993f349b66b..80628801cf09 100644
> --- a/drivers/media/platform/qcom/camss/camss-csid.c
> +++ b/drivers/media/platform/qcom/camss/camss-csid.c
> @@ -666,7 +666,7 @@ int msm_csid_subdev_init(struct camss *camss, struct csid_device *csid,
>         if (csid->num_supplies) {
>                 csid->supplies = devm_kmalloc_array(camss->dev,
>                                                     csid->num_supplies,
> -                                                   sizeof(csid->supplies),
> +                                                   sizeof(*csid->supplies),
>                                                     GFP_KERNEL);
>                 if (!csid->supplies)
>                         return -ENOMEM;
> --
> 2.25.1
>

Reviewed-by: Robert Foss <robert.foss@linaro.org>
diff mbox series

Patch

diff --git a/drivers/media/platform/qcom/camss/camss-csid.c b/drivers/media/platform/qcom/camss/camss-csid.c
index f993f349b66b..80628801cf09 100644
--- a/drivers/media/platform/qcom/camss/camss-csid.c
+++ b/drivers/media/platform/qcom/camss/camss-csid.c
@@ -666,7 +666,7 @@  int msm_csid_subdev_init(struct camss *camss, struct csid_device *csid,
 	if (csid->num_supplies) {
 		csid->supplies = devm_kmalloc_array(camss->dev,
 						    csid->num_supplies,
-						    sizeof(csid->supplies),
+						    sizeof(*csid->supplies),
 						    GFP_KERNEL);
 		if (!csid->supplies)
 			return -ENOMEM;