[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20200110220137.GA9387@kroah.com>
Date: Fri, 10 Jan 2020 23:01:37 +0100
From: Greg Kroah-Hartman <gregkh@...uxfoundation.org>
To: Dmitry Safonov <dima@...sta.com>
Cc: linux-kernel@...r.kernel.org,
Dmitry Safonov <0x7f454c46@...il.com>,
Jiri Slaby <jslaby@...e.com>,
Vasiliy Khoruzhick <vasilykh@...sta.com>,
linux-serial@...r.kernel.org, Iurii Zaikin <yzaikin@...gle.com>,
Luis Chamberlain <mcgrof@...nel.org>,
Kees Cook <keescook@...omium.org>,
linux-fsdevel@...r.kernel.org
Subject: Re: [PATCH-next 2/3] sysctl/sysrq: Remove __sysrq_enabled copy
On Fri, Jan 10, 2020 at 09:45:30PM +0000, Dmitry Safonov wrote:
> Hi Greg,
>
> On 1/10/20 4:40 PM, Greg Kroah-Hartman wrote:
> > On Thu, Jan 09, 2020 at 09:54:43PM +0000, Dmitry Safonov wrote:
> [..]
> >> @@ -2844,6 +2827,26 @@ static int proc_dostring_coredump(struct ctl_table *table, int write,
> >> }
> >> #endif
> >>
> >> +#ifdef CONFIG_MAGIC_SYSRQ
> >> +static int sysrq_sysctl_handler(struct ctl_table *table, int write,
> >> + void __user *buffer, size_t *lenp, loff_t *ppos)
> >> +{
> >> + int tmp, ret;
> >> +
> >> + tmp = sysrq_get_mask();
> >> +
> >> + ret = __do_proc_dointvec(&tmp, table, write, buffer,
> >> + lenp, ppos, NULL, NULL);
> >> + if (ret || !write)
> >> + return ret;
> >> +
> >> + if (write)
> >> + sysrq_toggle_support(tmp);
> >> +
> >> + return 0;
> >> +}
> >> +#endif
> >
> > Why did you move this function down here? Can't it stay where it is and
> > you can just fix the logic there? Now you have two different #ifdef
> > blocks intead of just one :(
>
> Yeah, well __do_proc_dointvec() made me do it.
>
> sysrq_sysctl_handler() declaration should be before ctl_table array of
> sysctls, so I couldn't remove the forward-declaration.
>
> So, I could forward-declare __do_proc_dointvec() instead, but looking at
> the neighborhood, I decided to follow the file-style (there is a couple
> of forward-declarations before the sysctl array, some under ifdefs).
>
> I admit that the result is imperfect and can put __do_proc_dointvec()
> definition before instead, no hard feelings.
Ah, no, nevermind, I missed that reason, sorry about that. Moving it is
fine.
greg k-h
Powered by blists - more mailing lists