From: Hans de Goede <hdegoede@redhat.com>
To: Kunwu Chan <chentao@kylinos.cn>,
ilpo.jarvinen@linux.intel.com, vadimp@nvidia.com,
jiri@resnulli.us, shravankr@nvidia.com
Cc: kunwu.chan@hotmail.com, platform-driver-x86@vger.kernel.org,
linux-kernel@vger.kernel.org
Subject: Re: [PATCH] platform/mellanox: Add a null pointer check in mlxbf_pmc_create_groups
Date: Mon, 27 Nov 2023 13:24:14 +0100 [thread overview]
Message-ID: <8d66d4c0-ebc2-43b1-98b3-c41c871b4b7e@redhat.com> (raw)
In-Reply-To: <20231127063433.1549064-1-chentao@kylinos.cn>
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@kylinos.cn>
Thanks, patch looks good to me:
Reviewed-by: Hans de Goede <hdegoede@redhat.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++;
>
next prev parent reply other threads:[~2023-11-27 12:24 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-11-27 6:34 Kunwu Chan
2023-11-27 12:24 ` Hans de Goede [this message]
2023-11-28 9:51 ` Ilpo Järvinen
[not found] ` <1701224213463629.329.seg@mailgw>
2023-11-30 9:43 ` Kunwu Chan
2023-11-30 15:25 ` Ilpo Järvinen
2023-11-30 16:01 ` Vadim Pasternak
2023-12-01 3:20 ` Kunwu Chan
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=8d66d4c0-ebc2-43b1-98b3-c41c871b4b7e@redhat.com \
--to=hdegoede@redhat.com \
--cc=chentao@kylinos.cn \
--cc=ilpo.jarvinen@linux.intel.com \
--cc=jiri@resnulli.us \
--cc=kunwu.chan@hotmail.com \
--cc=linux-kernel@vger.kernel.org \
--cc=platform-driver-x86@vger.kernel.org \
--cc=shravankr@nvidia.com \
--cc=vadimp@nvidia.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®