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-next>] [day] [month] [year] [list]
Date:	Wed, 08 Jul 2015 04:23:34 +0000 (GMT)
From:	Maninder Singh <maninder1.s@...sung.com>
To:	Doug Ledford <dledford@...hat.com>
Cc:	Sean Hefty <sean.hefty@...el.com>,
	Or Gerlitz <ogerlitz@...lanox.com>,
	David Miller <davem@...emloft.net>,
	"roland@...estorage.com" <roland@...estorage.com>,
	Matan Barak <matanb@...lanox.com>,
	Moni Shoua <monis@...lanox.com>,
	"jackm@....mellanox.co.il" <jackm@....mellanox.co.il>,
	Yishai Hadas <yishaih@...lanox.com>,
	"eranbe@...lanox.com" <eranbe@...lanox.com>,
	Ira Weiny <ira.weiny@...el.com>,
	linux-rdma <linux-rdma@...r.kernel.org>,
	linux-kernel <linux-kernel@...r.kernel.org>,
	PANKAJ MISHRA <pankaj.m@...sung.com>
Subject: Re: [PATCH 1/1] infiniband: Remove redundant NULL check before kfree

Hello,

>> +			for (i = 0; i < dev->caps.num_ports; i++)
>> +				kfree(dm[i]);
>> 			goto out;
>> 		}
>> 	}
>> --
>> 1.7.9.5
>> 
>
>If you are going to change this, you might as well make it 100% correct:
>
>i—-;
>while (i >= 0)
>	kfree(dm[i]);
>
>Then you don’t have to worry about whether kfree works on NULL, every item you free will be guaranteed to be non-NULL.
Thanks for suggestion :)
Sent new patch with described changes, I was thinking one more thing.

In below code :-
        if (!ibdev->sriov.is_going_down)
            queue_work(ibdev->sriov.demux[i].ud_wq, &dm[i]->work);
        spin_unlock_irqrestore(&ibdev->sriov.going_down_lock, flags);
    }
out:
    kfree(dm);
    return;

dm is freed after queue_work, is it correct to free dm when other dm[i] are allocated ? i did not get it.

Thanks
Maninder
------------

Powered by blists - more mailing lists