[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <8d66d4c0-ebc2-43b1-98b3-c41c871b4b7e@redhat.com>
Date: Mon, 27 Nov 2023 13:24:14 +0100
From: Hans de Goede <hdegoede@...hat.com>
To: Kunwu Chan <chentao@...inos.cn>, ilpo.jarvinen@...ux.intel.com,
vadimp@...dia.com, jiri@...nulli.us, shravankr@...dia.com
Cc: kunwu.chan@...mail.com, platform-driver-x86@...r.kernel.org,
linux-kernel@...r.kernel.org
Subject: Re: [PATCH] platform/mellanox: Add a null pointer check in
mlxbf_pmc_create_groups
Hi,
On 11/27/23 07:34, Kunwu Chan wrote:
> devm_kasprintf() returns a pointer to dynamically allocated memory
> which can be NULL upon failure.
>
> Fixes: 1a218d312e65 ("platform/mellanox: mlxbf-pmc: Add Mellanox BlueField PMC driver")
> Signed-off-by: Kunwu Chan <chentao@...inos.cn>
Thanks, patch looks good to me:
Reviewed-by: Hans de Goede <hdegoede@...hat.com>
Regards,
Hans
> ---
> drivers/platform/mellanox/mlxbf-pmc.c | 2 ++
> 1 file changed, 2 insertions(+)
>
> diff --git a/drivers/platform/mellanox/mlxbf-pmc.c b/drivers/platform/mellanox/mlxbf-pmc.c
> index 0b427fc24a96..59bbe5e13f6b 100644
> --- a/drivers/platform/mellanox/mlxbf-pmc.c
> +++ b/drivers/platform/mellanox/mlxbf-pmc.c
> @@ -1882,6 +1882,8 @@ static int mlxbf_pmc_create_groups(struct device *dev, int blk_num)
> pmc->block[blk_num].block_attr_grp.attrs = pmc->block[blk_num].block_attr;
> pmc->block[blk_num].block_attr_grp.name = devm_kasprintf(
> dev, GFP_KERNEL, pmc->block_name[blk_num]);
> + if (!pmc->block[blk_num].block_attr_grp.name)
> + return -ENOMEM;
> pmc->groups[pmc->group_num] = &pmc->block[blk_num].block_attr_grp;
> pmc->group_num++;
>
Powered by blists - more mailing lists