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] [day] [month] [year] [list]
Message-id: <5A08CB1B.6000201@samsung.com>
Date:   Mon, 13 Nov 2017 07:28:43 +0900
From:   Chanwoo Choi <cw00.choi@...sung.com>
To:     "Gustavo A. R. Silva" <garsilva@...eddedor.com>,
        MyungJoo Ham <myungjoo.ham@...sung.com>,
        Kyungmin Park <kyungmin.park@...sung.com>
Cc:     linux-pm@...r.kernel.org, linux-kernel@...r.kernel.org
Subject: Re: [PATCH] PM / devfreq: Remove unnecessary NULL check before
 kfree

Hi,

On 2017년 11월 12일 17:27, Gustavo A. R. Silva wrote:
> NULL check before freeing functions like kfree is not needed.
> 
> This issue was detected with the help of Coccinelle.
> 
> Signed-off-by: Gustavo A. R. Silva <garsilva@...eddedor.com>
> ---
>  drivers/devfreq/devfreq.c | 3 +--
>  1 file changed, 1 insertion(+), 2 deletions(-)
> 
> diff --git a/drivers/devfreq/devfreq.c b/drivers/devfreq/devfreq.c
> index 78fb496..21164a9 100644
> --- a/drivers/devfreq/devfreq.c
> +++ b/drivers/devfreq/devfreq.c
> @@ -672,8 +672,7 @@ struct devfreq *devfreq_add_device(struct device *dev,
>  
>  	device_unregister(&devfreq->dev);
>  err_dev:
> -	if (devfreq)
> -		kfree(devfreq);
> +	kfree(devfreq);
>  err_out:
>  	return ERR_PTR(err);
>  }
> 

It prevents the memory leak when the registration
of devfreq device is failed. You can check the
detailed reason on patch1[1].

[1] PM / devfreq: Fix memory leak when fail to register device
- https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=9e14de1077e9c34f141cf98bdba60cdd5193d962


-- 
Best Regards,
Chanwoo Choi
Samsung Electronics

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ