From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751101AbdBBEuR (ORCPT ); Wed, 1 Feb 2017 23:50:17 -0500 Received: from mail-pg0-f65.google.com ([74.125.83.65]:34642 "EHLO mail-pg0-f65.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750990AbdBBEuP (ORCPT ); Wed, 1 Feb 2017 23:50:15 -0500 Date: Thu, 2 Feb 2017 13:50:31 +0900 From: Sergey Senozhatsky To: Petr Mladek , Borislav Petkov Cc: Rabin Vincent , akpm@linux-foundation.org, linux-kernel@vger.kernel.org, Sergey Senozhatsky Subject: Re: [PATCH] printk: fix printk.devkmsg sysctl Message-ID: <20170202045031.GG1954@jagdpanzerIV.localdomain> References: <1485522706-18852-1-git-send-email-rabin.vincent@axis.com> <20170127150141.5w33ardlqab6rekz@pd.tnic> <20170127154230.GB3799@axis.com> <20170127181930.sshkgcocttbwu7k4@pd.tnic> <20170130133803.GH6620@pathway.suse.cz> <20170130170318.gvcxx7ouy54rwy2i@pd.tnic> <20170130223911.i7ja5ywyhaaopsgu@pd.tnic> <20170131135501.GT20462@pathway.suse.cz> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20170131135501.GT20462@pathway.suse.cz> User-Agent: Mutt/1.7.2 (2016-11-26) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hello, sorry, catching up with the emails. there seems to be two independent patches. I'll just comment in one thread. On (01/31/17 14:55), Petr Mladek wrote: [..] > From 0ce6125caf314270cb48202390d8a0938fdf316e Mon Sep 17 00:00:00 2001 > From: Petr Mladek > Date: Tue, 31 Jan 2017 12:00:13 +0100 > Subject: [PATCH] printk: Fix printk.devkmsg sysctl > > The code handling write into /proc/sys/kernel/printk_devkmsg expects > a new line at the end of the string but does not check it. As a result > it allows: > > # echo -n offX > /proc/sys/kernel/printk_devkmsg > # > > while at the same time it rejects legitimate uses: > > # echo -n off > /proc/sys/kernel/printk_devkmsg > -sh: echo: write error: Invalid argument > for these cases (echo/echo -n/echo -e/etc. etc.) I usually use sysfs_streq() from lib/string.c wouldn't sysfs_streq() do the trick here? -ss