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: <CAK8P3a0Dce3dYER0oJ+2FcV8UbJqCaAv7zSS6JZBdb6ewfnE7g@mail.gmail.com>
Date:   Fri, 6 Nov 2020 13:11:13 +0100
From:   Arnd Bergmann <arnd@...nel.org>
To:     Grygorii Strashko <grygorii.strashko@...com>
Cc:     Wang Qing <wangqing@...o.com>,
        "David S. Miller" <davem@...emloft.net>,
        Jakub Kicinski <kuba@...nel.org>,
        Samuel Zou <zou_wei@...wei.com>,
        Kurt Kanzenbach <kurt@...utronix.de>,
        Richard Cochran <richardcochran@...il.com>,
        Networking <netdev@...r.kernel.org>,
        "linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>
Subject: Re: [PATCH] net/ethernet: update ret when ptp_clock is ERROR

On Fri, Nov 6, 2020 at 12:35 PM Grygorii Strashko
<grygorii.strashko@...com> wrote:
> On 06/11/2020 09:56, Wang Qing wrote:

> > +++ b/drivers/net/ethernet/ti/am65-cpts.c
> > @@ -1001,8 +1001,7 @@ struct am65_cpts *am65_cpts_create(struct device *dev, void __iomem *regs,
>
> there is
>         cpts->ptp_clock = ptp_clock_register(&cpts->ptp_info, cpts->dev);
>
>
> >       if (IS_ERR_OR_NULL(cpts->ptp_clock)) {
>
> And ptp_clock_register() can return NULL only if PTP support is disabled.
> In which case, we should not even get here.
>
> So, I'd propose to s/IS_ERR_OR_NULL/IS_ERR above,
> and just assign ret = PTR_ERR(cpts->ptp_clock) here.

Right, using IS_ERR_OR_NULL() is almost ever a mistake, either
from misunderstanding the interface, or from a badly designed
interface that needs to be changed.

     Arnd

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ