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: 579104 Return-Path: X-Original-To: patchwork-incoming@ozlabs.org Delivered-To: patchwork-incoming@ozlabs.org Received: from lists.ozlabs.org (lists.ozlabs.org [103.22.144.68]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id DC67D1402ED for ; Fri, 5 Feb 2016 08:02:26 +1100 (AEDT) Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (1024-bit key; unprotected) header.d=chromium.org header.i=@chromium.org header.b=CW5eiHlJ; dkim-atps=neutral Received: from lists.ozlabs.org (lists.ozlabs.org [IPv6:2401:3900:2:1::3]) by lists.ozlabs.org (Postfix) with ESMTP id B75E21A028A for ; Fri, 5 Feb 2016 08:02:26 +1100 (AEDT) Authentication-Results: lists.ozlabs.org; dkim=fail reason="signature verification failed" (1024-bit key; unprotected) header.d=chromium.org header.i=@chromium.org header.b=CW5eiHlJ; dkim-atps=neutral X-Original-To: linuxppc-dev@lists.ozlabs.org Delivered-To: linuxppc-dev@lists.ozlabs.org Received: from mail-pa0-x231.google.com (mail-pa0-x231.google.com [IPv6:2607:f8b0:400e:c03::231]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by lists.ozlabs.org (Postfix) with ESMTPS id EE1A31A0221 for ; Fri, 5 Feb 2016 08:00:51 +1100 (AEDT) Authentication-Results: lists.ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=chromium.org header.i=@chromium.org header.b=CW5eiHlJ; dkim-atps=neutral Received: by mail-pa0-x231.google.com with SMTP id ho8so21401547pac.2 for ; Thu, 04 Feb 2016 13:00:51 -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=KHpzX0hEgsbeLyKKH6uMS1bx3Cphen7/18nGoqSQ/c/O+8cpnbwO7NRnNv4Tp1z8iR JMq5kvhFBpsdLIJACr6YOX2lMGLUcoWB4a3Q9pwjfsKMTqu7GFJgJoSedqG9eiIy6Zft cK96EWNoiYCSoiwkrPATy9+UrvfpbSfh8utkCVG4jn7nABcw6c6X1NxHNqJwrgHa8Kyz F+QA8+gYDgcRzklweIq3VPKpOz6r1F670vIJIa4ZF4GcL6ZlBNNvwqHUt03E/Eood9l1 YTKYA0v6NRnc7R2rPC8aMw4S8CDo5NK6EzGZ6wi5dKHWIQLMMQkonY3vzsvfC5qxKKt7 i3FQ== X-Gm-Message-State: AG10YOQ7l2ewPnccaLYyCPuCjup2ib+Fe6dcSCfzDSljuK+P2OosP/AoAewcRWO4WFXxSg== 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 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> X-BeenThere: linuxppc-dev@lists.ozlabs.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: Linux on PowerPC Developers Mail List List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: linux-s390@vger.kernel.org, Kees Cook , Daniel Borkmann , linux-cifs@vger.kernel.org, x86@kernel.org, Rasmus Villemoes , Nishant Sarmukadam , Heiko Carstens , linux-kernel@vger.kernel.org, Steve French , Martin Schwidefsky , Andy Shevchenko , netdev@vger.kernel.org, Amitkumar Karwar , linux-wireless@vger.kernel.org, Joe Perches , linuxppc-dev@lists.ozlabs.org, Kalle Valo MIME-Version: 1.0 Errors-To: linuxppc-dev-bounces+patchwork-incoming=ozlabs.org@lists.ozlabs.org Sender: "Linuxppc-dev" 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; }