From patchwork Thu Feb 4 21:00:42 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kees Cook X-Patchwork-Id: 8227651 Return-Path: X-Original-To: patchwork-cifs-client@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork2.web.kernel.org (Postfix) with ESMTP id CC8A1BEEE5 for ; Thu, 4 Feb 2016 21:02:39 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id F165F2038E for ; Thu, 4 Feb 2016 21:02:38 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 227A02039D for ; Thu, 4 Feb 2016 21:02:38 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1756859AbcBDVAw (ORCPT ); Thu, 4 Feb 2016 16:00:52 -0500 Received: from mail-pa0-f54.google.com ([209.85.220.54]:36023 "EHLO mail-pa0-f54.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754119AbcBDVAu (ORCPT ); Thu, 4 Feb 2016 16:00:50 -0500 Received: by mail-pa0-f54.google.com with SMTP id yy13so21359029pab.3 for ; Thu, 04 Feb 2016 13:00:50 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=USfyKeOfqcqL12IuqBWEnM4S/JHjetVFrs9Q0t6NclA=; b=CW5eiHlJ0lB/Ybnhw5W69DRj/1kJ8gENoi1SuXxAJ17xrJ5YZ6hL8MfAPk0qbXQhm5 BehCPOKqT6zhg4aWh30ZKAXAKiUJOCxtXrTCtpqh0pA7lj5ALxsiF0MLxXdLzS0D5SAl o8fvUdemYV+O6juuykXpRrN6RL+OmccyJgk8U= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=USfyKeOfqcqL12IuqBWEnM4S/JHjetVFrs9Q0t6NclA=; b=NbA0IWmOt/nQrbn0082137/yH2qYr7dggn3kCreQdCH/Sd3zksC3Ka3BArDLoiRBYj SvtY+Q3OvUUY+SpHVrnuYb8T+IpwqaIl1t3mxVUlWeAX1Q2BIvifBK6flrMVgWu8Gpkq Onlcenzqa7ufQ6IvdxAJl2SasVRpkwv94fQv1ll8rvgYri9A/8OCwExHGH1nYShkEs02 aWz6KzSNTGdNgai+52kmxEBMH3CCxvEHtCMbjfE9AQK5xrBR8xel8aWovrsS0/uG0GO0 NlIu2ZXQUEndNXM9ndTKM2w/zGSlYwejvM7yOyj5+KZHquLTo2J785+4I6fk65aiDLRs b/ww== X-Gm-Message-State: AG10YOQLrsD0YhTvC35CZRtpsJ5f8hovhZAnixPY5F8skchgIUQNYW9hiYIx+FmHfWECUg== X-Received: by 10.66.185.225 with SMTP id ff1mr13985674pac.97.1454619649760; Thu, 04 Feb 2016 13:00:49 -0800 (PST) Received: from www.outflux.net (smtp.outflux.net. [198.145.64.163]) by smtp.gmail.com with ESMTPSA id n27sm19218823pfb.53.2016.02.04.13.00.48 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 04 Feb 2016 13:00:48 -0800 (PST) From: Kees Cook To: Andrew Morton Cc: Kees Cook , Joe Perches , Andy Shevchenko , 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, linux-wireless@vger.kernel.org, netdev@vger.kernel.org, linux-cifs@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH v2 3/4] lib: add "on"/"off" support to kstrtobool Date: Thu, 4 Feb 2016 13:00:42 -0800 Message-Id: <1454619643-14444-4-git-send-email-keescook@chromium.org> X-Mailer: git-send-email 2.6.3 In-Reply-To: <1454619643-14444-1-git-send-email-keescook@chromium.org> References: <1454619643-14444-1-git-send-email-keescook@chromium.org> Sender: linux-cifs-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-cifs@vger.kernel.org X-Spam-Status: No, score=-7.2 required=5.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_HI,RP_MATCHES_RCVD,T_DKIM_INVALID,UNPARSEABLE_RELAY autolearn=ham version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP 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) 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; }