Received: by 2002:a25:8b91:0:0:0:0:0 with SMTP id j17csp1203344ybl; Fri, 10 Jan 2020 14:03:21 -0800 (PST) X-Google-Smtp-Source: APXvYqxElFEaIWwbjxtr44CdtUWuYL0IggGe4BIfLLJim256q2uodC+EnBhx2Ug8lqGbCLDFPwII X-Received: by 2002:aca:f242:: with SMTP id q63mr4093449oih.72.1578693801623; Fri, 10 Jan 2020 14:03:21 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1578693801; cv=none; d=google.com; s=arc-20160816; b=dROk4lzfaGRWH1qhlcSscXB4StggTRgE9VisSNzHLQ86Lreq9LAVs6KS9/CLfRzJYK bB4KUpC6uBnkYz0oMLxb1ze3qUlofsikhALHBgW57jcjD8yiOkmGinFrLsl43A3qB8fb Wxlaowl/W+CxUqYV8syi6A6xpqAOJjD/YLIMSKxwNdnR4vZgoN6+lxm6SZXMenWk+rs9 Ibp3mZvXjV0Qiky4UE3bW2ii90OYF6tVZM6sZd9XIUNvsd2dgdwueFF6/4fTbRJ76jv8 ow3UBAEHdfyn8I9SCNYKVXzRsXwdkDjG0ndmIUVmrtNHGul4d3m8tWV1w4JzT9N+E3pC feKQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:in-reply-to:content-disposition :mime-version:references:message-id:subject:cc:to:from:date :dkim-signature; bh=OuT6Aj961FYKBcRu6nGeLFdZHQlKkGGEmAprIqgpKQU=; b=qeHsToWoxwoCyVrVkfMSJWYHd90BL5IAagS4zjVth1tXRPzUGHYJFvFAP/LOIsGQF2 mwzkqrKJi+LEreebkiP++R8OEVwTNJ5GsA3fAzDmCsUYQ+A0ufSALWVV5D7unD37zzRp 3eV8UdsEY4voOGr111oWSSUSmF3Os3+0LDhMFy3d4JKcDDXAyoA/Lg8zfmAQq/BatAQN pWkfVn0nTA5E1rRHUHjnwgFqHjrr4+v0MpK3nxoptGW65w+vUV9n+VM9TJ1iUga1ykAA HaxQ4HnnVex4JK9/N9qQkJhRyOXhaNa8+MMW14y0CeRRmV4oVhEZjEB6E+u8t5+CqkSD yhFg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=ZPNE2zb4; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id j19si1692110oij.51.2020.01.10.14.03.09; Fri, 10 Jan 2020 14:03:21 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=ZPNE2zb4; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727304AbgAJWBl (ORCPT + 99 others); Fri, 10 Jan 2020 17:01:41 -0500 Received: from mail.kernel.org ([198.145.29.99]:46962 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727227AbgAJWBl (ORCPT ); Fri, 10 Jan 2020 17:01:41 -0500 Received: from localhost (83-86-89-107.cable.dynamic.v4.ziggo.nl [83.86.89.107]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 19B632082E; Fri, 10 Jan 2020 22:01:39 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1578693700; bh=y78F7EkDKzvyrK1oupSN61NtpNTuyNmqqSBPHBi1g3w=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=ZPNE2zb4PFZ3Oz35DFjfUZHw66krtBSRqkiXSrtRCySb4LNDj7j1hCiI1xArS2IAh WPzWViMtDrZTMRInb2MLD9dROprtUUmI1YyOwkT5npDNQZ+xv+r54p95aHDozjPpg7 j5fVEpiM88yQKvc5Drcc19e80+XtryFrjqV+mCFg= Date: Fri, 10 Jan 2020 23:01:37 +0100 From: Greg Kroah-Hartman To: Dmitry Safonov Cc: linux-kernel@vger.kernel.org, Dmitry Safonov <0x7f454c46@gmail.com>, Jiri Slaby , Vasiliy Khoruzhick , linux-serial@vger.kernel.org, Iurii Zaikin , Luis Chamberlain , Kees Cook , linux-fsdevel@vger.kernel.org Subject: Re: [PATCH-next 2/3] sysctl/sysrq: Remove __sysrq_enabled copy Message-ID: <20200110220137.GA9387@kroah.com> References: <20200109215444.95995-1-dima@arista.com> <20200109215444.95995-3-dima@arista.com> <20200110164035.GA1822445@kroah.com> <04436968-5e89-0286-81e5-61acbe583f73@arista.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <04436968-5e89-0286-81e5-61acbe583f73@arista.com> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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