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:   Fri, 8 Oct 2021 03:44:48 +0300
From:   Leon Romanovsky <leon@...nel.org>
To:     Steven Rostedt <rostedt@...dmis.org>
Cc:     "David S . Miller" <davem@...emloft.net>,
        Jakub Kicinski <kuba@...nel.org>,
        Ido Schimmel <idosch@...dia.com>,
        Ingo Molnar <mingo@...hat.com>, Jiri Pirko <jiri@...dia.com>,
        linux-kernel@...r.kernel.org, linux-rdma@...r.kernel.org,
        mlxsw@...dia.com, Moshe Shemesh <moshe@...dia.com>,
        netdev@...r.kernel.org, Saeed Mahameed <saeedm@...dia.com>,
        Salil Mehta <salil.mehta@...wei.com>,
        Shay Drory <shayd@...dia.com>,
        Tariq Toukan <tariqt@...dia.com>,
        Yisen Zhuang <yisen.zhuang@...wei.com>
Subject: Re: [PATCH net-next v3 1/5] devlink: Reduce struct devlink exposure

On Thu, Oct 07, 2021 at 03:58:00PM -0400, Steven Rostedt wrote:
> On Thu,  7 Oct 2021 09:55:15 +0300
> Leon Romanovsky <leon@...nel.org> wrote:
> 
> > +void *devlink_priv(struct devlink *devlink)
> > +{
> > +	BUG_ON(!devlink);
> 
> Do we really want to bring down the kernel in this case?

It was before.

> 
> Can't we just have:
> 
> 	if (WARN_ON(!devlink))
> 		return NULL;
> ?

Callers of devlink_priv() are not prepared to have NULL here, they don't
check return value at all,and this BUG_ON() can't happen at all.

> 
> Same for the below as well.

I can send followup patch.

Thanks

> 
> -- Steve
> 
> > +	return &devlink->priv;
> > +}
> > +EXPORT_SYMBOL_GPL(devlink_priv);
> > +
> > +struct devlink *priv_to_devlink(void *priv)
> > +{
> > +	BUG_ON(!priv);
> > +	return container_of(priv, struct devlink, priv);
> > +}
> > +EXPORT_SYMBOL_GPL(priv_to_devlink);
> > +
> > +struct device *devlink_to_dev(const struct devlink *devlink)
> > +{
> > +	return devlink->dev;
> > +}
> > +EXPORT_SYMBOL_GPL(devlink_to_dev);
> > +

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ