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] [day] [month] [year] [list]
Date:   Wed, 9 Sep 2020 11:46:21 +0300
From:   Andy Shevchenko <andy.shevchenko@...il.com>
To:     Greg Kroah-Hartman <gregkh@...uxfoundation.org>
Cc:     Krzysztof Kozlowski <krzk@...nel.org>,
        Andy Shevchenko <andriy.shevchenko@...ux.intel.com>,
        Andrzej Hajda <a.hajda@...sung.com>,
        "linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>,
        Joe Perches <joe@...ches.com>,
        "Rafael J . Wysocki" <rafael@...nel.org>,
        Stephen Rothwell <sfr@...b.auug.org.au>
Subject: Re: [PATCH v1] driver core: Annotate dev_err_probe() with __must_check

On Wed, Sep 9, 2020 at 10:40 AM Greg Kroah-Hartman
<gregkh@...uxfoundation.org> wrote:
> On Wed, Sep 09, 2020 at 09:08:14AM +0200, Krzysztof Kozlowski wrote:
> > On Wed, 9 Sep 2020 at 09:02, Greg Kroah-Hartman
> > <gregkh@...uxfoundation.org> wrote:
> > > On Wed, Sep 09, 2020 at 08:29:25AM +0200, Krzysztof Kozlowski wrote:
> > > > On Wed, 26 Aug 2020 at 18:18, Joe Perches <joe@...ches.com> wrote:
> > > > > On Wed, 2020-08-26 at 18:55 +0300, Andy Shevchenko wrote:
> > > > > > On Wed, Aug 26, 2020 at 08:44:30AM -0700, Joe Perches wrote:
> > > > > > > On Wed, 2020-08-26 at 13:44 +0300, Andy Shevchenko wrote:
> > > > > >
> > > > > > ...
> > > > > >
> > > > > > > > -int dev_err_probe(const struct device *dev, int err, const char *fmt, ...);
> > > > > > > > +int __must_check dev_err_probe(const struct device *dev, int err, const char *fmt, ...);
> > > >
> > > > +Cc Stephen and Greg,
> > > >
> > > > Hi Andy,
> > > >
> > > > Did this patch ended up in next somehow? I am surprised because now I
> > > > got warnings for perfectly fine code:
> > > > https://lore.kernel.org/linux-next/20200909155654.76fe3bd6@canb.auug.org.au/T/#u
> > > >
> > > > This creates simply false warnings instead of hints for "optimization".
> > >
> > > Yes, it got merged into m y driver core tree.
> > >
> > > I'll fix up the tty build warning, should be easy enough, the patch is
> > > below.
> >
> > Yes, this fix suppresses the warning but the question is whether we
> > really want the warning?
> > Such fixes mean additional code which the compiler might not optimize
> > (unless it inlines the dev_err_probe()). This additional code is
> > purely for suppressing the warning, without any meaning on its own.
> > Actually it might be even confusing for someone to see:
> > if (ret)
> >   ret = dev_err_probe(ret);

The problem here is that the dev_err_probe() returns int on purpose.
In your patch what I can see it seems another issue is that the driver
is semi converted to devm API and thus uses goto:s here and there.

> Yeah, that is dumb, as the patch I made shows :(

I agree.

> > warn_unused_result should point errors, not "optimization
> > opportunities". If you want to have opportunity, add a coccinelle
> > rule. Or a checkpatch rule. Not a compiler warning.
>
> Ok, I now agree, I'll go revert this patch and trust that driver authors
> will "do the right thing" here...

I'm fine (as I stated during a review of that patch) to go either way,
but I see it would be nice to have drivers be better thought about
using devm APIs.

-- 
With Best Regards,
Andy Shevchenko

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ