Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S934463AbbLQWCA (ORCPT ); Thu, 17 Dec 2015 17:02:00 -0500 Received: from mga01.intel.com ([192.55.52.88]:31381 "EHLO mga01.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932226AbbLQWB6 (ORCPT ); Thu, 17 Dec 2015 17:01:58 -0500 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.20,443,1444719600"; d="scan'208";a="863345447" Subject: [PATCH 1/5] x86: pass in size to early cmdline parsing To: linux-kernel@vger.kernel.org Cc: Dave Hansen , dave.hansen@linux.intel.com, bp@suse.de, hpa@zytor.com, fenghua.yu@intel.com, yu-cheng.yu@intel.com From: Dave Hansen Date: Thu, 17 Dec 2015 14:00:51 -0800 Message-Id: <20151217220051.E8C7A8C9@viggo.jf.intel.com> Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1781 Lines: 55 From: Dave Hansen We will use this in a few patches to implement tests for early parsing. Signed-off-by: Dave Hansen Cc: Borislav Petkov Cc: H. Peter Anvin Cc: linux-kernel@vger.kernel.org Cc: fenghua.yu@intel.com Cc: yu-cheng.yu@intel.com --- b/arch/x86/lib/cmdline.c | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff -puN arch/x86/lib/cmdline.c~pass-in-cmdline-size arch/x86/lib/cmdline.c --- a/arch/x86/lib/cmdline.c~pass-in-cmdline-size 2015-12-17 13:54:52.534928192 -0800 +++ b/arch/x86/lib/cmdline.c 2015-12-17 13:54:52.537928328 -0800 @@ -23,7 +23,8 @@ static inline int myisspace(u8 c) * Returns the position of that @option (starts counting with 1) * or 0 on not found. */ -int cmdline_find_option_bool(const char *cmdline, const char *option) +static int __cmdline_find_option_bool(const char *cmdline, + int max_cmdline_size, const char *option) { char c; int len, pos = 0, wstart = 0; @@ -37,7 +38,7 @@ int cmdline_find_option_bool(const char if (!cmdline) return -1; /* No command line */ - len = min_t(int, strlen(cmdline), COMMAND_LINE_SIZE); + len = min_t(int, strlen(cmdline), max_cmdline_size); if (!len) return 0; @@ -82,3 +83,9 @@ int cmdline_find_option_bool(const char return 0; /* Buffer overrun */ } + +int cmdline_find_option_bool(const char *cmdline, const char *option) +{ + return __cmdline_find_option_bool(cmdline, COMMAND_LINE_SIZE, + option); +} _ -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/