From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 84E4BC4332F for ; Sat, 12 Nov 2022 12:01:17 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234874AbiKLMBQ (ORCPT ); Sat, 12 Nov 2022 07:01:16 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46424 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231534AbiKLMBM (ORCPT ); Sat, 12 Nov 2022 07:01:12 -0500 Received: from 1wt.eu (wtarreau.pck.nerim.net [62.212.114.60]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id EBFB8167FC for ; Sat, 12 Nov 2022 04:01:11 -0800 (PST) Received: (from willy@localhost) by pcw.home.local (8.15.2/8.15.2/Submit) id 2ACC19ug005595; Sat, 12 Nov 2022 13:01:09 +0100 Date: Sat, 12 Nov 2022 13:01:09 +0100 From: Willy Tarreau To: A Cc: linux-kernel@vger.kernel.org Subject: Re: Setting variable NULL after freeing it. Message-ID: <20221112120109.GA5592@1wt.eu> References: <20221112074759.GA5111@1wt.eu> <20221112113410.GA5553@1wt.eu> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.10.1 (2018-07-13) Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Sat, Nov 12, 2022 at 05:28:04PM +0530, A wrote: > I was just thinking that when this is good practice (where its usage > is genuine), then why is there not a kernel wide macro that would call > kfree(x) and then set (x) = NULL. So, this will be done automatically > for everyone and the developer will not have to decide whether to do > this or not. Very likely because developers want to decide. Willy