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: <815dea03-ef9a-39c0-3ec5-cdd58a545911@canonical.com>
Date:   Thu, 7 Mar 2019 10:23:28 +0000
From:   Colin Ian King <colin.king@...onical.com>
To:     Leon Romanovsky <leon@...nel.org>
Cc:     Faisal Latif <faisal.latif@...el.com>,
        Doug Ledford <dledford@...hat.com>,
        Jason Gunthorpe <jgg@...pe.ca>, linux-rdma@...r.kernel.org,
        kernel-janitors@...r.kernel.org, linux-kernel@...r.kernel.org
Subject: Re: [PATCH][next] RDMA/nes: remove redundant check on udata

On 04/03/2019 06:36, Leon Romanovsky wrote:
> On Sat, Mar 02, 2019 at 11:06:36PM +0000, Colin King wrote:
>> From: Colin Ian King <colin.king@...onical.com>
>>
>> The non-null check on udata is redundant as this check was performed
>> just a few statements earlier and the check is always true as udata
>> must be non-null at this point. Remove redundant the check on udata
>> and the redundant else part that can never be executed.
>>
>> Detected by CoverityScan, CID#1477317 ("Logically dead code")
>>
>> Signed-off-by: Colin Ian King <colin.king@...onical.com>
>> ---
>>  drivers/infiniband/hw/nes/nes_verbs.c | 73 +++++++++++++--------------
>>  1 file changed, 34 insertions(+), 39 deletions(-)
>>
>> diff --git a/drivers/infiniband/hw/nes/nes_verbs.c b/drivers/infiniband/hw/nes/nes_verbs.c
>> index 828e4af3f951..526092d435df 100644
>> --- a/drivers/infiniband/hw/nes/nes_verbs.c
>> +++ b/drivers/infiniband/hw/nes/nes_verbs.c
>> @@ -1039,53 +1039,48 @@ static struct ib_qp *nes_create_qp(struct ib_pd *ibpd,
>>  				}
>>  				if (req.user_qp_buffer)
>>  					nesqp->nesuqp_addr = req.user_qp_buffer;
>> -				if (udata) {
>> -					nesqp->user_mode = 1;
> 
> It was single place where user_mode was set, you should continue and
> remove all code which depends on "if (nesqp->user_mode)".

This is not the only place where user_mode is being set; we currently have:


        if (udata) {
                if (ib_copy_from_udata(&req, udata, sizeof(struct
nes_create_qp_req))) {
                        nes_free_resource(nesadapter,
nesadapter->allocated_qps, qp_num);
                        kfree(nesqp->allocated_buffer);
                        nes_debug(NES_DBG_QP, "ib_copy_from_udata()
Failed \n");
                        return ERR_PTR(-EFAULT);
                }
                if (req.user_wqe_buffers) {
                        virt_wqs = 1;
                }
                if (req.user_qp_buffer)
                        nesqp->nesuqp_addr = req.user_qp_buffer;
                if (udata) {
                        nesqp->user_mode = 1;
			...


and I'm just removing the redudant 2nd if (udata) check, so the
nesqp->user_mode = 1 assignment is still being kept hence it's not
correct to remove all the if (nesqp->user_mode) releated code.


> 
> I looked on the change which triggered Coverity warning and looks like
> your commit message should include this Fixes line:
> Fixes: 899444505473 ("IB/{hw,sw}: Remove 'uobject->context' dependency in object creation APIs")

Can that be added to the patch before it's applied?

> 
> Thanks
> 

Colin



Download attachment "signature.asc" of type "application/pgp-signature" (834 bytes)

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ