From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753969AbcHWRWi (ORCPT ); Tue, 23 Aug 2016 13:22:38 -0400 Received: from mx1.polytechnique.org ([129.104.30.34]:41814 "EHLO mx1.polytechnique.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751640AbcHWRWh (ORCPT ); Tue, 23 Aug 2016 13:22:37 -0400 From: Nicolas Iooss To: Andrew Morton , Joe Perches Cc: linux-kernel@vger.kernel.org, Nicolas Iooss Subject: [PATCH v2 1/1] printk: fix parsing of "brl=" option Date: Tue, 23 Aug 2016 18:57:00 +0200 Message-Id: <20160823165700.28952-1-nicolas.iooss_linux@m4x.org> X-Mailer: git-send-email 2.9.3 X-AV-Checked: ClamAV using ClamSMTP at svoboda.polytechnique.org (Tue Aug 23 18:57:19 2016 +0200 (CEST)) X-Spam-Flag: No, tests=bogofilter, spamicity=0.000153, queueID=C88AF5647E6 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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 and replace memcmp() with strncmp() to make the compiler able to detect such an issue. Fixes: bbeddf52adc1 ("printk: move braille console support into separate braille.[ch] files") Signed-off-by: Nicolas Iooss --- kernel/printk/braille.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/kernel/printk/braille.c b/kernel/printk/braille.c index 276762f3a460..d5760c42f042 100644 --- a/kernel/printk/braille.c +++ b/kernel/printk/braille.c @@ -9,10 +9,10 @@ char *_braille_console_setup(char **str, char **brl_options) { - if (!memcmp(*str, "brl,", 4)) { + if (!strncmp(*str, "brl,", 4)) { *brl_options = ""; *str += 4; - } else if (!memcmp(str, "brl=", 4)) { + } else if (!strncmp(*str, "brl=", 4)) { *brl_options = *str + 4; *str = strchr(*brl_options, ','); if (!*str) -- 2.9.3