linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Xiaoming Ni <nixiaoming@huawei.com>
To: Greg KH <gregkh@linuxfoundation.org>,
	Luis Chamberlain <mcgrof@kernel.org>
Cc: <keescook@chromium.org>, <yzaikin@google.com>,
	<ebiederm@xmission.com>, <axboe@kernel.dk>, <clemens@ladisch.de>,
	<arnd@arndb.de>, <jani.nikula@linux.intel.com>,
	<joonas.lahtinen@linux.intel.com>, <rodrigo.vivi@intel.com>,
	<airlied@linux.ie>, <daniel@ffwll.ch>, <benh@kernel.crashing.org>,
	<rdna@fb.com>, <viro@zeniv.linux.org.uk>, <mark@fasheh.com>,
	<jlbec@evilplan.org>, <joseph.qi@linux.alibaba.com>,
	<vbabka@suse.cz>, <sfr@canb.auug.org.au>, <jack@suse.cz>,
	<amir73il@gmail.com>, <rafael@kernel.org>, <tytso@mit.edu>,
	<julia.lawall@lip6.fr>, <akpm@linux-foundation.org>,
	<intel-gfx@lists.freedesktop.org>,
	<dri-devel@lists.freedesktop.org>,
	<linuxppc-dev@lists.ozlabs.org>, <ocfs2-devel@oss.oracle.com>,
	<linux-kernel@vger.kernel.org>
Subject: Re: [PATCH 11/13] random: simplify sysctl declaration with register_sysctl_subdir()
Date: Fri, 29 May 2020 20:09:01 +0800	[thread overview]
Message-ID: <289b2d65-bf28-1246-7f4f-2411e3f27e16@huawei.com> (raw)
In-Reply-To: <20200529102644.GB1345939@kroah.com>

On 2020/5/29 18:26, Greg KH wrote:
> On Fri, May 29, 2020 at 07:41:06AM +0000, Luis Chamberlain wrote:
>> From: Xiaoming Ni <nixiaoming@huawei.com>
>>
>> Move random_table sysctl from kernel/sysctl.c to drivers/char/random.c
>> and use register_sysctl_subdir() to help remove the clutter out of
>> kernel/sysctl.c.
>>
>> Signed-off-by: Xiaoming Ni <nixiaoming@huawei.com>
>> Signed-off-by: Luis Chamberlain <mcgrof@kernel.org>
>> ---
>>   drivers/char/random.c  | 14 ++++++++++++--
>>   include/linux/sysctl.h |  1 -
>>   kernel/sysctl.c        |  5 -----
>>   3 files changed, 12 insertions(+), 8 deletions(-)
>>
>> diff --git a/drivers/char/random.c b/drivers/char/random.c
>> index a7cf6aa65908..73fd4b6e9c18 100644
>> --- a/drivers/char/random.c
>> +++ b/drivers/char/random.c
>> @@ -2101,8 +2101,7 @@ static int proc_do_entropy(struct ctl_table *table, int write,
>>   }
>>   
>>   static int sysctl_poolsize = INPUT_POOL_WORDS * 32;
>> -extern struct ctl_table random_table[];
>> -struct ctl_table random_table[] = {
>> +static struct ctl_table random_table[] = {
>>   	{
>>   		.procname	= "poolsize",
>>   		.data		= &sysctl_poolsize,
>> @@ -2164,6 +2163,17 @@ struct ctl_table random_table[] = {
>>   #endif
>>   	{ }
>>   };
>> +
>> +/*
>> + * rand_initialize() is called before sysctl_init(),
>> + * so we cannot call register_sysctl_init() in rand_initialize()
>> + */
>> +static int __init random_sysctls_init(void)
>> +{
>> +	register_sysctl_subdir("kernel", "random", random_table);
> 
> No error checking?
> 
> :(
It was my mistake, I forgot to add a comment here.
Same as the comment of register_sysctl_init(),
There is almost no failure here during the system initialization phase,
and failure in time does not affect the main function.

Thanks
Xiaoming Ni




  reply	other threads:[~2020-05-29 12:09 UTC|newest]

Thread overview: 32+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-05-29  7:40 [PATCH 00/13] sysctl: spring cleaning Luis Chamberlain
2020-05-29  7:40 ` [PATCH 01/13] sysctl: add new register_sysctl_subdir() helper Luis Chamberlain
2020-05-29  8:13   ` Jani Nikula
2020-05-29 12:16     ` Luis Chamberlain
2020-05-29 12:40   ` Eric W. Biederman
2020-05-29 12:42     ` Eric W. Biederman
2020-05-29  7:40 ` [PATCH 02/13] cdrom: use new sysctl subdir helper register_sysctl_subdir() Luis Chamberlain
2020-05-29 12:46   ` Eric W. Biederman
2020-05-29  7:40 ` [PATCH 03/13] hpet: " Luis Chamberlain
2020-05-29  7:40 ` [PATCH 04/13] i915: " Luis Chamberlain
2020-05-29  7:41 ` [PATCH 05/13] macintosh/mac_hid.c: " Luis Chamberlain
2020-05-29  7:41 ` [PATCH 06/13] ocfs2: " Luis Chamberlain
2020-05-29  8:23   ` Kees Cook
2020-05-29 11:49     ` [Intel-gfx] " Luis Chamberlain
2020-05-29 14:49       ` Kees Cook
2020-05-29  7:41 ` [PATCH 07/13] test_sysctl: " Luis Chamberlain
2020-05-29  7:41 ` [PATCH 08/13] inotify: simplify sysctl declaration with register_sysctl_subdir() Luis Chamberlain
2020-05-29  7:41 ` [PATCH 09/13] firmware_loader: " Luis Chamberlain
2020-05-29 10:26   ` Greg KH
2020-05-29 11:59     ` Xiaoming Ni
2020-05-29 12:09     ` Luis Chamberlain
2020-05-29  7:41 ` [PATCH 10/13] eventpoll: " Luis Chamberlain
2020-05-29  7:41 ` [PATCH 11/13] random: " Luis Chamberlain
2020-05-29 10:26   ` Greg KH
2020-05-29 12:09     ` Xiaoming Ni [this message]
2020-05-29  7:41 ` [PATCH 12/13] sysctl: add helper to register empty subdir Luis Chamberlain
2020-05-29  8:15   ` Kees Cook
2020-05-29 13:03   ` Eric W. Biederman
2021-11-17  3:30     ` Luis Chamberlain
2020-05-29  7:41 ` [PATCH 13/13] fs: move binfmt_misc sysctl to its own file Luis Chamberlain
2020-05-29  8:14   ` Kees Cook
2020-06-04  8:45   ` Xiaoming Ni

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=289b2d65-bf28-1246-7f4f-2411e3f27e16@huawei.com \
    --to=nixiaoming@huawei.com \
    --cc=airlied@linux.ie \
    --cc=akpm@linux-foundation.org \
    --cc=amir73il@gmail.com \
    --cc=arnd@arndb.de \
    --cc=axboe@kernel.dk \
    --cc=benh@kernel.crashing.org \
    --cc=clemens@ladisch.de \
    --cc=daniel@ffwll.ch \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=ebiederm@xmission.com \
    --cc=gregkh@linuxfoundation.org \
    --cc=intel-gfx@lists.freedesktop.org \
    --cc=jack@suse.cz \
    --cc=jani.nikula@linux.intel.com \
    --cc=jlbec@evilplan.org \
    --cc=joonas.lahtinen@linux.intel.com \
    --cc=joseph.qi@linux.alibaba.com \
    --cc=julia.lawall@lip6.fr \
    --cc=keescook@chromium.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linuxppc-dev@lists.ozlabs.org \
    --cc=mark@fasheh.com \
    --cc=mcgrof@kernel.org \
    --cc=ocfs2-devel@oss.oracle.com \
    --cc=rafael@kernel.org \
    --cc=rdna@fb.com \
    --cc=rodrigo.vivi@intel.com \
    --cc=sfr@canb.auug.org.au \
    --cc=tytso@mit.edu \
    --cc=vbabka@suse.cz \
    --cc=viro@zeniv.linux.org.uk \
    --cc=yzaikin@google.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).