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>] [day] [month] [year] [list]
Message-ID: <20191025095037.GA19336@sivswdev08.ir.intel.com>
Date:   Fri, 25 Oct 2019 10:50:37 +0100
From:   Giovanni Cabiddu <giovanni.cabiddu@...el.com>
To:     Yunfeng Ye <yeyunfeng@...wei.com>
Cc:     Ard Biesheuvel <ard.biesheuvel@...aro.org>,
        Herbert Xu <herbert@...dor.apana.org.au>,
        "David S. Miller" <davem@...emloft.net>,
        qat-linux <qat-linux@...el.com>,
        "open list:HARDWARE RANDOM NUMBER GENERATOR CORE" 
        <linux-crypto@...r.kernel.org>,
        Linux Kernel Mailing List <linux-kernel@...r.kernel.org>,
        "hushiyuan@...wei.com" <hushiyuan@...wei.com>,
        "linfeilong@...wei.com" <linfeilong@...wei.com>
Subject: Re: [PATCH] crypto: qat - remove redundant condition
 accel_dev->is_vf

On Fri, Oct 25, 2019 at 10:45:31AM +0100, Yunfeng Ye wrote:
> On 2019/10/25 17:33, Ard Biesheuvel wrote:
> > On Fri, 25 Oct 2019 at 09:24, Yunfeng Ye <yeyunfeng@...wei.com> wrote:
> >>
> >> Warning is found by the code analysis tool:
> >>   "Redundant condition: accel_dev->is_vf"
> >>
> >> So remove the redundant condition accel_dev->is_vf.
> >>
> >> Signed-off-by: Yunfeng Ye <yeyunfeng@...wei.com>
> >> ---
> >>  drivers/crypto/qat/qat_common/adf_dev_mgr.c | 4 ++--
> >>  1 file changed, 2 insertions(+), 2 deletions(-)
> >>
> >> diff --git a/drivers/crypto/qat/qat_common/adf_dev_mgr.c b/drivers/crypto/qat/qat_common/adf_dev_mgr.c
> >> index 2d06409bd3c4..b54b8850fe20 100644
> >> --- a/drivers/crypto/qat/qat_common/adf_dev_mgr.c
> >> +++ b/drivers/crypto/qat/qat_common/adf_dev_mgr.c
> >> @@ -196,7 +196,7 @@ int adf_devmgr_add_dev(struct adf_accel_dev *accel_dev,
> >>         atomic_set(&accel_dev->ref_count, 0);
> >>
> >>         /* PF on host or VF on guest */
> >> -       if (!accel_dev->is_vf || (accel_dev->is_vf && !pf)) {
> >> +       if (!accel_dev->is_vf || !pf) {
> > 
> > I disagree with this change. There is no bug here, and the way the
> > condition is formulated self-documents the code, i.e.,
> > 
> > IF NOT is_vf
> > OR (is_vf BUT NOT pf)
> > 
> > Using an automated tool to reduce every boolean expression to its
> > minimal representation doesn't seem that useful to me, since the
> > compiler is perfectly capable of doing that when generating the object
> > code.
> > 
> ok, thanks, this modify just fix warning, and make code simple.
This change simplifies the code but it makes it less readable.
I'd prefer to leave it as it was.

Regards,

-- 
Giovanni

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ