From: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
To: Dmitry Safonov <dima@arista.com>
Cc: linux-kernel@vger.kernel.org,
Dmitry Safonov <0x7f454c46@gmail.com>,
Jiri Slaby <jslaby@suse.com>,
Vasiliy Khoruzhick <vasilykh@arista.com>,
linux-serial@vger.kernel.org, Iurii Zaikin <yzaikin@google.com>,
Luis Chamberlain <mcgrof@kernel.org>,
Kees Cook <keescook@chromium.org>,
linux-fsdevel@vger.kernel.org
Subject: Re: [PATCH-next 2/3] sysctl/sysrq: Remove __sysrq_enabled copy
Date: Fri, 10 Jan 2020 23:01:37 +0100 [thread overview]
Message-ID: <20200110220137.GA9387@kroah.com> (raw)
In-Reply-To: <04436968-5e89-0286-81e5-61acbe583f73@arista.com>
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
prev parent reply other threads:[~2020-01-10 22:01 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-01-09 21:54 [PATCH-next 0/3] serial/sysrq: Add MAGIC_SYSRQ_SERIAL_SEQUENCE Dmitry Safonov
2020-01-09 21:54 ` [PATCH-next 2/3] sysctl/sysrq: Remove __sysrq_enabled copy Dmitry Safonov
2020-01-10 3:19 ` Iurii Zaikin
2020-01-10 21:48 ` Dmitry Safonov
2020-01-10 16:40 ` Greg Kroah-Hartman
2020-01-10 21:45 ` Dmitry Safonov
2020-01-10 22:01 ` Greg Kroah-Hartman [this message]
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=20200110220137.GA9387@kroah.com \
--to=gregkh@linuxfoundation.org \
--cc=0x7f454c46@gmail.com \
--cc=dima@arista.com \
--cc=jslaby@suse.com \
--cc=keescook@chromium.org \
--cc=linux-fsdevel@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-serial@vger.kernel.org \
--cc=mcgrof@kernel.org \
--cc=vasilykh@arista.com \
--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).