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]
Message-ID: <ZDGAlpI+5hfcHe3r@corigine.com>
Date:   Sat, 8 Apr 2023 16:56:22 +0200
From:   Simon Horman <simon.horman@...igine.com>
To:     Sai Krishna <saikrishnag@...vell.com>
Cc:     davem@...emloft.net, edumazet@...gle.com, kuba@...nel.org,
        pabeni@...hat.com, netdev@...r.kernel.org,
        linux-kernel@...r.kernel.org, sgoutham@...vell.com,
        gakula@...vell.com, richardcochran@...il.com, lcherian@...vell.com,
        jerinj@...vell.com, hkelam@...vell.com, sbhatta@...vell.com,
        Ratheesh Kannoth <rkannoth@...vell.com>
Subject: Re: [net PATCH v2 6/7] octeontx2-af: Skip PFs if not enabled

On Fri, Apr 07, 2023 at 05:53:43PM +0530, Sai Krishna wrote:
> From: Ratheesh Kannoth <rkannoth@...vell.com>
> 
> Skip mbox initialization of disabled PFs. Firmware configures PFs
> and allocate mbox resources etc. Linux should configure particular
> PFs, which ever are enabled by firmware.
> 
> Fixes: 9bdc47a6e328 ("octeontx2-af: Mbox communication support btw AF and it's VFs")
> Signed-off-by: Ratheesh Kannoth <rkannoth@...vell.com>
> Signed-off-by: Sunil Kovvuri Goutham <sgoutham@...vell.com>
> Signed-off-by: Sai Krishna <saikrishnag@...vell.com>

...

> @@ -2343,8 +2349,27 @@ static int rvu_mbox_init(struct rvu *rvu, struct mbox_wq_info *mw,
>  	int err = -EINVAL, i, dir, dir_up;
>  	void __iomem *reg_base;
>  	struct rvu_work *mwork;
> +	unsigned long *pf_bmap;
>  	void **mbox_regions;
>  	const char *name;
> +	u64 cfg;
> +
> +	pf_bmap = devm_kcalloc(rvu->dev, BITS_TO_LONGS(num), sizeof(long), GFP_KERNEL);

Hi Sai and Ratheesh,

I am a little confused about the lifecycle of pf_bmap.
It is a local variable of this function.
But it is allocated using devm_kcalloc(), so it will persist for
the life of the device.

Also, I note that rvu_mbox_init() has too call sites.
So is there a situation where a pf_bmap is allocated more than once
for the same rvu->dev instance?

It seems to me it would be more appropriate to allocate bf_bmap using
kcalloc() take clear to free it before leaving rvu_mbox_init(),
as is already done for mbox_regions.

> +	if (!pf_bmap)
> +		return -ENOMEM;

...

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ