From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753992AbcHWQrQ (ORCPT ); Tue, 23 Aug 2016 12:47:16 -0400 Received: from mail-wm0-f66.google.com ([74.125.82.66]:34520 "EHLO mail-wm0-f66.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752700AbcHWQrO (ORCPT ); Tue, 23 Aug 2016 12:47:14 -0400 Subject: Re: [PATCH 1/1] printk: fix parsing of "brl=" option To: Joe Perches , Andrew Morton References: <20160823154735.26294-1-nicolas.iooss_linux@m4x.org> <1471969508.3746.112.camel@perches.com> Cc: linux-kernel@vger.kernel.org From: Nicolas Iooss Message-ID: <05cec956-2e20-e44f-374e-512d35c5d02b@m4x.org> Date: Tue, 23 Aug 2016 18:46:24 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Thunderbird/45.2.0 MIME-Version: 1.0 In-Reply-To: <1471969508.3746.112.camel@perches.com> Content-Type: text/plain; charset=windows-1252 Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 23/08/16 18:25, Joe Perches wrote: > On Tue, 2016-08-23 at 17:47 +0200, Nicolas Iooss wrote: >> Commit bbeddf52adc1 ("printk: move braille console support into separate >> braille.[ch] files") moved the parsing of braille-related options into >> _braille_console_setup(), changing the type of variable str from char* >> to char**. In this commit, memcmp(str, "brl,", 4) was correctly updated >> to memcmp(*str, "brl,", 4) but not memcmp(str, "brl=", 4). >> >> Update the code to make "brl=" option work again. >> >> Fixes: bbeddf52adc1 ("printk: move braille console support into separate >> braille.[ch] files") >> Signed-off-by: Nicolas Iooss >> --- >> kernel/printk/braille.c | 2 +- >> 1 file changed, 1 insertion(+), 1 deletion(-) >> >> diff --git a/kernel/printk/braille.c b/kernel/printk/braille.c >> index 276762f3a460..f735ade8494c 100644 >> --- a/kernel/printk/braille.c >> +++ b/kernel/printk/braille.c >> @@ -12,7 +12,7 @@ char *_braille_console_setup(char **str, char **brl_options) >> if (!memcmp(*str, "brl,", 4)) { >> *brl_options = ""; >> *str += 4; >> - } else if (!memcmp(str, "brl=", 4)) { >> + } else if (!memcmp(*str, "brl=", 4)) { >> *brl_options = *str + 4; >> *str = strchr(*brl_options, ','); >> if (!*str) > > Thanks. > > likely the first memcmp here should be strcmp > and the second should be strncmp > > That would have caused the compiler to show > the defect. The first memcmp should also be a strncmp (there is a comma after brl). Anyway I agree with your proposition and will send a v2 with strncmp. Nicolas