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: <20250612083819.GS10669@unreal>
Date: Thu, 12 Jun 2025 11:38:19 +0300
From: Leon Romanovsky <leon@...nel.org>
To: Markus Elfring <Markus.Elfring@....de>
Cc: linux-rdma@...r.kernel.org, Jason Gunthorpe <jgg@...pe.ca>,
	Potnuri Bharat Teja <bharat@...lsio.com>,
	LKML <linux-kernel@...r.kernel.org>,
	kernel-janitors@...r.kernel.org
Subject: Re: [PATCH] RDMA/cxgb4: Delete an unnecessary check before kfree()
 in c4iw_rdev_open()

On Tue, Jun 10, 2025 at 02:20:17PM +0200, Markus Elfring wrote:
> From: Markus Elfring <elfring@...rs.sourceforge.net>
> Date: Tue, 10 Jun 2025 14:14:09 +0200
> 
> It can be known that the function “kfree” performs a null pointer check
> for its input parameter.
> It is therefore not needed to repeat such a check before its call.
> 
> Thus remove a redundant pointer check.
> 
> The source code was transformed by using the Coccinelle software.
> 
> Signed-off-by: Markus Elfring <elfring@...rs.sourceforge.net>
> ---
>  drivers/infiniband/hw/cxgb4/device.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/infiniband/hw/cxgb4/device.c b/drivers/infiniband/hw/cxgb4/device.c
> index 034b85c42255..c0eb166a49b9 100644
> --- a/drivers/infiniband/hw/cxgb4/device.c
> +++ b/drivers/infiniband/hw/cxgb4/device.c
> @@ -905,7 +905,7 @@ static int c4iw_rdev_open(struct c4iw_rdev *rdev)
>  
>  	return 0;
>  err_free_status_page_and_wr_log:
> -	if (c4iw_wr_log && rdev->wr_log)
> +	if (c4iw_wr_log)

This is not needed too, fixed locally.

>  		kfree(rdev->wr_log);
>  	free_page((unsigned long)rdev->status_page);
>  destroy_ocqp_pool:
> -- 
> 2.49.0
> 
> 

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ