Received: by 2002:a25:868d:0:0:0:0:0 with SMTP id z13csp3210783ybk; Mon, 18 May 2020 21:47:50 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzUJZwkYdh9QPIhs0GW/b4ca3bOk3skE59ULv5dQCT4cR59V53a0EY+7D3lDotns0WWemt3 X-Received: by 2002:a50:fa8d:: with SMTP id w13mr15536537edr.280.1589863670271; Mon, 18 May 2020 21:47:50 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1589863670; cv=none; d=google.com; s=arc-20160816; b=RV4PSEk8zyGeBqcvz2sSqrjyV2Qp7wzNkBOimpHuml3PtTY5W6cwZuNNnsmW4vU+fq svKQxy1v8ACzoN2GX39AAXQ6PDClE58h2Lf3Orn9wx4dC+STOuDfEQ7Y9KKzu9yC4dOu O1bWogiWVoMPsVX5RCLJSl6jmo3pJobT77FYrN4I+0VQmtXdcknenO+dOjmmnpbv27DR gqDNU6UcG2rHZvCcA3M4ZzCrDjBwZ1LLT0epD46H5n9K0TG3LBsERMkqFC010nqTcv5C FmMUK4ECdN73OakoEh9bdDRZT7XzqGQAzMM1gWhVAKdbn9qiKQ5cfU4CQ+MaN6wdaVKR /Tcw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding :content-language:in-reply-to:mime-version:user-agent:date :message-id:from:references:cc:to:subject; bh=mCi43/y/v9e4zDDbhB/iVPHox+vbzDt8YrCBA42wKOo=; b=ylpLgcNleZZyYXlEr1MVcMAWMLcVxaE3jW97eAAXNe8nNW2lgfeWigKxHX3z6p6Ckq FtfoxkvjxYoo9i+avMXAz7cBB9XBLXoId1lnfDYF1gCysUE7LUigBPJJ/Z7b3vbSYCN3 Cy0OkFNE4TJChdSxKJoYeZH0gChgTMjsti2H/zVWHkEzke9TXN7HBPkbsYOUZ38/5k91 FsLOro6FyagFDeLE+amfrGPXns1Hnq6MnQ1BltflaqRQ+GzBLAdjxVw+6RztKrUvVDJ3 /prW4Y8Zh6/W0akMeu/AMPeOi7bBXXXgIY1kRju1Kq7jt4bw2ybcSQSJOSPdUsCLU9yG yETA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id o22si7653626ejr.146.2020.05.18.21.47.26; Mon, 18 May 2020 21:47:50 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726384AbgESEqA (ORCPT + 99 others); Tue, 19 May 2020 00:46:00 -0400 Received: from www262.sakura.ne.jp ([202.181.97.72]:55482 "EHLO www262.sakura.ne.jp" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726045AbgESEqA (ORCPT ); Tue, 19 May 2020 00:46:00 -0400 Received: from fsav401.sakura.ne.jp (fsav401.sakura.ne.jp [133.242.250.100]) by www262.sakura.ne.jp (8.15.2/8.15.2) with ESMTP id 04J4iXXc050017; Tue, 19 May 2020 13:44:33 +0900 (JST) (envelope-from penguin-kernel@i-love.sakura.ne.jp) Received: from www262.sakura.ne.jp (202.181.97.72) by fsav401.sakura.ne.jp (F-Secure/fsigk_smtp/550/fsav401.sakura.ne.jp); Tue, 19 May 2020 13:44:33 +0900 (JST) X-Virus-Status: clean(F-Secure/fsigk_smtp/550/fsav401.sakura.ne.jp) Received: from [192.168.1.9] (M106072142033.v4.enabler.ne.jp [106.72.142.33]) (authenticated bits=0) by www262.sakura.ne.jp (8.15.2/8.15.2) with ESMTPSA id 04J4iXTE050013 (version=TLSv1.2 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Tue, 19 May 2020 13:44:33 +0900 (JST) (envelope-from penguin-kernel@i-love.sakura.ne.jp) Subject: Re: [PATCH v4 2/4] sysctl: Move some boundary constants form sysctl.c to sysctl_vals To: Xiaoming Ni , keescook@chromium.org Cc: mcgrof@kernel.org, yzaikin@google.com, adobriyan@gmail.com, mingo@kernel.org, gpiccoli@canonical.com, rdna@fb.com, patrick.bellasi@arm.com, sfr@canb.auug.org.au, akpm@linux-foundation.org, mhocko@suse.com, vbabka@suse.cz, tglx@linutronix.de, peterz@infradead.org, Jisheng.Zhang@synaptics.com, khlebnikov@yandex-team.ru, bigeasy@linutronix.de, pmladek@suse.com, linux-kernel@vger.kernel.org, linux-fsdevel@vger.kernel.org, wangle6@huawei.com, alex.huangjianhui@huawei.com References: <1589859071-25898-1-git-send-email-nixiaoming@huawei.com> <1589859071-25898-3-git-send-email-nixiaoming@huawei.com> From: Tetsuo Handa Message-ID: <1bf1aefb-adfd-4f43-35c7-5b320d43faf8@i-love.sakura.ne.jp> Date: Tue, 19 May 2020 13:44:30 +0900 User-Agent: Mozilla/5.0 (Windows NT 6.3; WOW64; rv:68.0) Gecko/20100101 Thunderbird/68.8.0 MIME-Version: 1.0 In-Reply-To: <1589859071-25898-3-git-send-email-nixiaoming@huawei.com> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 2020/05/19 12:31, Xiaoming Ni wrote: > Some boundary (.extra1 .extra2) constants (E.g: neg_one two) in > sysctl.c are used in multiple features. Move these variables to > sysctl_vals to avoid adding duplicate variables when cleaning up > sysctls table. > > Signed-off-by: Xiaoming Ni > Reviewed-by: Kees Cook I feel that it is use of void *extra1; void *extra2; in "struct ctl_table" that requires constant values indirection. Can't we get rid of sysctl_vals using some "union" like below? struct ctl_table { const char *procname; /* Text ID for /proc/sys, or zero */ void *data; int maxlen; umode_t mode; struct ctl_table *child; /* Deprecated */ proc_handler *proc_handler; /* Callback for text formatting */ struct ctl_table_poll *poll; union { void *min_max_ptr[2]; int min_max_int[2]; long min_max_long[2]; }; } __randomize_layout;