From patchwork Wed Feb 5 17:03:59 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Leif Lindholm X-Patchwork-Id: 3587611 Return-Path: X-Original-To: patchwork-linux-arm@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork2.web.kernel.org (Postfix) with ESMTP id 65A22C02DC for ; Wed, 5 Feb 2014 17:09:29 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 98CA920149 for ; Wed, 5 Feb 2014 17:09:28 +0000 (UTC) Received: from casper.infradead.org (casper.infradead.org [85.118.1.10]) (using TLSv1.2 with cipher DHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id A4C5020123 for ; Wed, 5 Feb 2014 17:09:27 +0000 (UTC) Received: from merlin.infradead.org ([2001:4978:20e::2]) by casper.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1WB5wb-0004G2-Ii; Wed, 05 Feb 2014 17:07:26 +0000 Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.80.1 #2 (Red Hat Linux)) id 1WB5w6-0001lZ-4D; Wed, 05 Feb 2014 17:06:54 +0000 Received: from mail-wg0-f50.google.com ([74.125.82.50]) by merlin.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1WB5uu-0001YR-28 for linux-arm-kernel@lists.infradead.org; Wed, 05 Feb 2014 17:05:43 +0000 Received: by mail-wg0-f50.google.com with SMTP id l18so500713wgh.29 for ; Wed, 05 Feb 2014 09:05:20 -0800 (PST) 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=bXBAfASFLfo/GCu05fkbiBy/OKcXkPlBLSiTd9QZBBI=; b=CpYrm5JFSRIZlvjPK7+/+KPKIHb62uAQXNaZk2GnBN/lJE/7ak06bmQUPKM3ws1T1a oNfd5uvS4GW0ya/g0nTnEl249Y/U4vx9CwOVlmoMyU8h1EGi05r8tpiqFV1WhD/ni2+r XQIGKm36H5QUnl+GF6MxWaNFg/J5v7fPHNxBbdDVqGHCbtGJp85dGKxibZUxWLNvJKrw B8OokFjFkFigH2zcagn7fDmPnBumF/zFwHFHvbgZkRnEDHm7tCCQybRGM05vv5R4Ultb pY42Q2T3q2IvV8fjuG77haqR7FBH/c+ybtxBDJmyabHxaiK3C/umqA7lshjGtUDurxAW c9DA== X-Gm-Message-State: ALoCoQnBK1C/wLIdoSaNLbPZRgprrEn4E+OEkVXt6oC5jrzQB1oaesUl39Gc6eaWRMlEL2Dk0Dka X-Received: by 10.180.96.102 with SMTP id dr6mr13425077wib.61.1391619920687; Wed, 05 Feb 2014 09:05:20 -0800 (PST) Received: from mohikan.mushroom.smurfnet.nu (cpc4-cmbg17-2-0-cust71.5-4.cable.virginm.net. [86.14.224.72]) by mx.google.com with ESMTPSA id p1sm47427211wie.1.2014.02.05.09.05.19 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 05 Feb 2014 09:05:19 -0800 (PST) From: Leif Lindholm To: linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-efi@vger.kernel.org Subject: [PATCH 08/22] Add strstr to compressed string.c for ARM. Date: Wed, 5 Feb 2014 17:03:59 +0000 Message-Id: <1391619853-10601-9-git-send-email-leif.lindholm@linaro.org> X-Mailer: git-send-email 1.7.10.4 In-Reply-To: <1391619853-10601-1-git-send-email-leif.lindholm@linaro.org> References: <1391619853-10601-1-git-send-email-leif.lindholm@linaro.org> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20140205_120540_289167_A8031395 X-CRM114-Status: GOOD ( 11.77 ) X-Spam-Score: -2.6 (--) Cc: Roy Franz , Leif Lindholm , patches@linaro.org X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Spam-Status: No, score=-4.7 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_MED, RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=unavailable 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 From: Roy Franz The shared efi-stub-helper.c functions require a strstr implementation. The EFI stub is part of the decompressor, so it does not use the kernel strstr() implementation. This patch adds a strstr() implementation to the string.c file for the decompressor, with the implementation copied from the arch/x86/boot/string.c file used by the x86 decompressor. Signed-off-by: Roy Franz Signed-off-by: Leif Lindholm Reviewed-by: Grant Likely --- arch/arm/boot/compressed/string.c | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/arch/arm/boot/compressed/string.c b/arch/arm/boot/compressed/string.c index 36e53ef..5397792 100644 --- a/arch/arm/boot/compressed/string.c +++ b/arch/arm/boot/compressed/string.c @@ -111,6 +111,27 @@ char *strchr(const char *s, int c) return (char *)s; } +/** + * strstr - Find the first substring in a %NUL terminated string + * @s1: The string to be searched + * @s2: The string to search for + */ +char *strstr(const char *s1, const char *s2) +{ + size_t l1, l2; + + l2 = strlen(s2); + if (!l2) + return (char *)s1; + l1 = strlen(s1); + while (l1 >= l2) { + l1--; + if (!memcmp(s1, s2, l2)) + return (char *)s1; + s1++; + } + return NULL; +} #undef memset void *memset(void *s, int c, size_t count)