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: <6bd95c39-724e-04b8-5fda-8c9aefa17491@infradead.org>
Date:   Wed, 17 Jan 2018 10:44:08 -0800
From:   Randy Dunlap <rdunlap@...radead.org>
To:     Jose Bale <jb1987212@...il.com>, linux-kernel@...r.kernel.org
Subject: Re: Hi (Assigning NULL to variable after freeing it).

On 01/17/18 02:44, Jose Bale wrote:
> Hi All,
> 
> I have just started to contribute to linux kernel. I was thinking of
> giving a patch where a variable is made null after free if not already
> done.
> 
> Some thing like this:
> Original code:
>   kfree(x);
>   ...........some other code...........
> 
> I will change this code to:
> New code:
>   kfree(x);
> ++ x = NULL;
>   ...........some other code...........
> 
> Will this kind of code change be accepted by linux kernel?
> 
> Also, isn't doing this a better practice - that is, assigning NULL to
> variable after freeing it? What is the best practice? What do people
> think about it?
> 
> Any feedback / replies will be greatly appreciated.

General answer is no... unless that particular code expects a freed pointer
to be null.  In many cases the code is written so that this isn't needed,
so you would have to check each usage on a case-by-case basis.

Probably best to find something else to patch.

-- 
~Randy

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ