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 X-Spam-Level: X-Spam-Status: No, score=-5.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS autolearn=no autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 468FDC4332B for ; Thu, 7 Jan 2021 09:14:35 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id F22842312E for ; Thu, 7 Jan 2021 09:14:34 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727420AbhAGJO3 (ORCPT ); Thu, 7 Jan 2021 04:14:29 -0500 Received: from mail1.protonmail.ch ([185.70.40.18]:37366 "EHLO mail1.protonmail.ch" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726862AbhAGJO2 (ORCPT ); Thu, 7 Jan 2021 04:14:28 -0500 Date: Thu, 07 Jan 2021 09:13:40 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=pm.me; s=protonmail; t=1610010826; bh=hvwIoelUi1wx+za4I6FAa+/pn9VbnZdTGjdvOxoB1zU=; h=Date:To:From:Cc:Reply-To:Subject:In-Reply-To:References:From; b=Y3+xzT7cHW/sNusbEjY8I4TqKzQszsQ7W6lvZv6YnOxGsezOcMfGYhuhpdn3kejN+ EzvCGyjX8hJEzXfyggRFglqAnLo8WjnnkOB0MlOl1TVghUW/66ovOGBFr+L9a7vQUA xCwEwngvOEhR++W5p+IVwC/ludLOiIOn+GVFyyKoUU+x8J5nPXYbnjymhZL8GFAEoh bGe9VlzdM4Wqcl/45Z+xyRzTE7r4iG+2/EJ3zF421XDEDxwx3aJ0M1DQiL2g9V7hO9 KnSqX5cWxOZdvL9yUcfDRqU03dCJDM0t3uvUKA/4wZmk78i/i02LgUK9fx+9Ke5/u9 c/ZAqI6rZ3pmg== To: Jakub Kicinski From: Alexander Lobakin Cc: Alexander Lobakin , "David S. Miller" , netdev@vger.kernel.org, linux-kernel@vger.kernel.org Reply-To: Alexander Lobakin Subject: Re: [PATCH net-next] net: sysctl: cleanup net_sysctl_init() Message-ID: <20210107091318.2184-1-alobakin@pm.me> In-Reply-To: <20210106163056.79d75ffa@kicinski-fedora-pc1c0hjn.dhcp.thefacebook.com> References: <20210106204014.34730-1-alobakin@pm.me> <20210106163056.79d75ffa@kicinski-fedora-pc1c0hjn.dhcp.thefacebook.com> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Jakub Kicinski Date: Wed, 6 Jan 2021 16:30:56 -0800 > On Wed, 06 Jan 2021 20:40:28 +0000 Alexander Lobakin wrote: >> 'net_header' is not used outside of this function, so can be moved >> from BSS onto the stack. >> Declarations of one-element arrays are discouraged, and there's no >> need to store 'empty' in BSS. Simply allocate it from heap at init. > > Are you sure? It's passed as an argument to register_sysctl() > so it may well need to be valid for the lifetime of net_header. I just moved it from BSS to the heap and allocate it using kzalloc(), it's still valid through the lifetime of the kernel. Al