Re: [PATCH-next 2/3] sysctl/sysrq: Remove __sysrq_enabled copy

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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.

Thanks,
          Dmitry



[Index of Archives]     [Kernel Newbies]     [Security]     [Netfilter]     [Bugtraq]     [Linux PPP]     [Linux FS]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Samba]     [Video 4 Linux]     [Linmodem]     [Device Mapper]     [Linux Kernel for ARM]

  Powered by Linux