From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932964AbdA0POH (ORCPT ); Fri, 27 Jan 2017 10:14:07 -0500 Received: from mx2.suse.de ([195.135.220.15]:57582 "EHLO mx2.suse.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932226AbdA0PN5 (ORCPT ); Fri, 27 Jan 2017 10:13:57 -0500 Date: Fri, 27 Jan 2017 16:01:41 +0100 From: Borislav Petkov To: Rabin Vincent Cc: akpm@linux-foundation.org, linux-kernel@vger.kernel.org, Rabin Vincent Subject: Re: [PATCH] printk: fix printk.devkmsg sysctl Message-ID: <20170127150141.5w33ardlqab6rekz@pd.tnic> References: <1485522706-18852-1-git-send-email-rabin.vincent@axis.com> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <1485522706-18852-1-git-send-email-rabin.vincent@axis.com> User-Agent: NeoMutt/20161014 (1.7.1) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, Jan 27, 2017 at 02:11:46PM +0100, Rabin Vincent wrote: > From: Rabin Vincent > > The comment says that it doesn't want to accept trailing crap but that's > just what it allows: ... > @@ -177,7 +177,7 @@ int devkmsg_sysctl_set_loglvl(struct ctl_table *table, int write, > * Do not accept an unknown string OR a known string with > * trailing crap... > */ > - if (err < 0 || (err + 1 != *lenp)) { Grr, that's that damn '\n' echo off > /proc/sys/kernel/printk_devkmsg works, of course. Ok, I don't want to relax the strncmp() above and would still like to return the exact length compared. So please change the check above to allow the following inputs: or \n I.e., a trailing, *optional*, '\n' is allowed. This way we're accepting the two most common ways to input strings: $ echo > ... and $ echo -n > ... Thanks! -- Regards/Gruss, Boris. SUSE Linux GmbH, GF: Felix Imendörffer, Jane Smithard, Graham Norton, HRB 21284 (AG Nürnberg) --