Received: by 2002:a05:6358:d09b:b0:dc:cd0c:909e with SMTP id jc27csp3373925rwb; Sat, 12 Nov 2022 04:43:50 -0800 (PST) X-Google-Smtp-Source: AA0mqf6jzbA7d1rAP/PT7cuVjjwVxRMEkphf436LxwMVZ6yiZfk6rZtqHCdHvIIj8kDiyBqz1ska X-Received: by 2002:a17:90a:560b:b0:212:ec84:91d9 with SMTP id r11-20020a17090a560b00b00212ec8491d9mr6453080pjf.139.1668257030306; Sat, 12 Nov 2022 04:43:50 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1668257030; cv=none; d=google.com; s=arc-20160816; b=ozIsu5cJjMl0Swj7A5lcHWSCF57OVwIH2BqviLCS1ZIHNYRcz14nfSVdQIz0+kMbg2 bpjqn6fitTb4z5FkwoCkJM9gvuB/V8a4lPLwnw3RasP4AVH37mskiC6/+p1UuyIXXYU7 FlRNXi6iBfeZnkIOyL+qiZpExgJ4IekAArinNxqJLmTgoMJoP+gb0inXQXW2waoStdhO DNza5SyOWnCj1Q18V4g9iYtn2idD4DtUfz6C5YrzjXB+LWtuk5X/OgZqog8N8K2VSVbf b6/Oj/uacs6hFPpxZ4OlGveTGsUxmGBlhJlk71fAJME2wfyEM8nmuJ+hnNremGGoxL3J Sjew== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:user-agent:in-reply-to:content-disposition :mime-version:references:message-id:subject:cc:to:from:date; bh=qJ7NUZ9dbJ5XiftLKwzrMB62Px8G/30mn54e83JuYAA=; b=zpoulw9MoAbWpsWaAzdEz5h23AFC7U7jdINJ8Y6DAObsrNJ30lgrK/jxVAJIjQTD33 xtzLMOgzgdChTFMW4KbWmwt4lTry7y14Rb/9f+v5v2pny1M3MUcmPMfGPsw5x2LjU6KB YBx/ohfaVkJl23AFQ8+qy5ibaM7ZkIOy5mpZ5Ch2POGz8CFdAENQwk4H3gpufVvVkLBg ApAnBCpkApgi4zUbJLb0gHkUz50T+PTFzA0hYuezzIQrmAElP2I7EFIfjtZ52wr88+Fn h8jgp0CYuMty561WtYFiZitgokCA7YYatHi4iy/QzzSFqwX9HtCYSBga6VqgcWPBErZb 1nUw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id g3-20020a17090a714300b0020d5dfb9d69si4822989pjs.187.2022.11.12.04.43.39; Sat, 12 Nov 2022 04:43:50 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234714AbiKLMBP (ORCPT + 90 others); Sat, 12 Nov 2022 07:01:15 -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) X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,SPF_HELO_PASS, SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net 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