From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1758207AbcBDXLl (ORCPT ); Thu, 4 Feb 2016 18:11:41 -0500 Received: from mail-io0-f180.google.com ([209.85.223.180]:33537 "EHLO mail-io0-f180.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1757431AbcBDXLg (ORCPT ); Thu, 4 Feb 2016 18:11:36 -0500 MIME-Version: 1.0 In-Reply-To: References: <1454619643-14444-1-git-send-email-keescook@chromium.org> <1454619643-14444-4-git-send-email-keescook@chromium.org> Date: Thu, 4 Feb 2016 15:11:34 -0800 X-Google-Sender-Auth: EG8C16ZUEbiGCITy2v8H_mLE8Vo Message-ID: Subject: Re: [PATCH v2 3/4] lib: add "on"/"off" support to kstrtobool From: Kees Cook To: Andy Shevchenko Cc: Andrew Morton , Joe Perches , Rasmus Villemoes , Daniel Borkmann , Amitkumar Karwar , Nishant Sarmukadam , Kalle Valo , Steve French , Michael Ellerman , Heiko Carstens , Martin Schwidefsky , "x86@kernel.org" , "linuxppc-dev@lists.ozlabs.org" , "linux-s390@vger.kernel.org" , "open list:TI WILINK WIRELES..." , netdev , linux-cifs@vger.kernel.org, "linux-kernel@vger.kernel.org" Content-Type: text/plain; charset=UTF-8 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, Feb 4, 2016 at 3:00 PM, Andy Shevchenko wrote: > On Thu, Feb 4, 2016 at 11:00 PM, Kees Cook wrote: >> Add support for "on" and "off" when converting to boolean. >> >> Signed-off-by: Kees Cook >> --- >> lib/kstrtox.c | 14 ++++++++++++++ >> 1 file changed, 14 insertions(+) >> >> diff --git a/lib/kstrtox.c b/lib/kstrtox.c >> index e18f088704d7..09e83a19a96d 100644 >> --- a/lib/kstrtox.c >> +++ b/lib/kstrtox.c >> @@ -347,6 +347,20 @@ int kstrtobool(const char *s, unsigned int base, bool *res) > > Forgot update description? Argh, thank you. Good eye. Sent another update. -Kees > >> case '0': >> *res = false; >> return 0; >> + case 'o': >> + case 'O': >> + switch (s[1]) { >> + case 'n': >> + case 'N': >> + *res = true; >> + return 0; >> + case 'f': >> + case 'F': >> + *res = false; >> + return 0; >> + default: >> + break; >> + } >> default: >> break; >> } >> -- >> 2.6.3 >> > > > > -- > With Best Regards, > Andy Shevchenko -- Kees Cook Chrome OS & Brillo Security