lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:   Thu, 30 Nov 2023 17:25:34 +0200 (EET)
From:   Ilpo Järvinen <ilpo.jarvinen@...ux.intel.com>
To:     Kunwu Chan <chentao@...inos.cn>, vadimp@...dia.com
cc:     Hans de Goede <hdegoede@...hat.com>, jiri@...nulli.us,
        shravankr@...dia.com, kunwu.chan@...mail.com,
        platform-driver-x86@...r.kernel.org,
        LKML <linux-kernel@...r.kernel.org>
Subject: Re: [PATCH] platform/mellanox: Add a null pointer check in
 mlxbf_pmc_create_groups

Hi Vadim,

Could you please take a look at this and give advice to Kunwu so we can 
get all of them squashed in one go.

On Thu, 30 Nov 2023, Kunwu Chan wrote:

> Thanks for your reply.
> 
> Cause i don't know how to deal with in some scenario,such as in
> 'mlxbf_pmc_init_perftype_counter', when 'attr->dev_attr.attr.name' is null,
> should return '-ENOMEM' or 'continue' the loop?

I'd have thought returning -ENOMEM would be safe because it just ends up 
failing probe()? ...And it's not that likely to occur in the first place.

-- 
 i.

> 
> So I'm going to solve it one by one.
> 
> Thanks again,
> Kunwu
> 
> On 2023/11/28 17:51, Ilpo Järvinen wrote:
> > On Mon, 27 Nov 2023, 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>
> > > ---
> > >   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++;
> > 
> > I'm totally lost, why did you fix only one devm_kasprintf() location?
> > Don't all of them need this check?
> > 
> 

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ