From patchwork Fri Jan 10 16:30:14 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Roy Franz X-Patchwork-Id: 3467191 Return-Path: X-Original-To: patchwork-linux-arm@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork1.web.kernel.org (Postfix) with ESMTP id 95E9F9F2E9 for ; Fri, 10 Jan 2014 16:34:24 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 0F26C2011D for ; Fri, 10 Jan 2014 16:34:20 +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 49719200F0 for ; Fri, 10 Jan 2014 16:34:15 +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 1W1f0M-0007M3-SQ; Fri, 10 Jan 2014 16:32:19 +0000 Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.80.1 #2 (Red Hat Linux)) id 1W1ezt-0005hk-6m; Fri, 10 Jan 2014 16:31:49 +0000 Received: from mail-pa0-f53.google.com ([209.85.220.53]) by merlin.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1W1ez3-0005Zx-U9 for linux-arm-kernel@lists.infradead.org; Fri, 10 Jan 2014 16:30:58 +0000 Received: by mail-pa0-f53.google.com with SMTP id hz1so4926281pad.26 for ; Fri, 10 Jan 2014 08:30:36 -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=lIrSEzt2HO0U7tP6JCBQpvdrX0GZZ4VHoOUzKXCFow4=; b=Kfzj8zkywgP3d/zFWcYXc0YqarSwgLjh0CTr3vWnC0TBJFLCa3fAOHzJXZ9muTw7RH AFmoj69WUJi2r48toA3m3EDxHIJD0V/QWEsZmW6x94xLgnh7gX+UfdKW++Dd6JCQ+AS0 7Ptl+VFE6LQREHxcojza8OtuYokDHGrkc3UFTivdsWVIOG/42QwGnXAAbQg0TbOJBHLS 6eD6Rx6i55ZAKopTOaCey96tz0DKlc8XctqvPTFQPP2i4mznvp47bxfjsPehnUDymZe6 c89X2J+cLjVW1paUM+hT8y+Lcc1lrCSruqPHs2VgbARFNXuy9l7qY8kL6MJJph712zAw VL2A== X-Gm-Message-State: ALoCoQklyXuFFT3GIK3jCN8XP5qtkY8OLP9VS2tAk+jFYMjhSyIV679IP4QFYdm0R6XAeHuzwRYl X-Received: by 10.66.149.73 with SMTP id ty9mr12664345pab.36.1389371435422; Fri, 10 Jan 2014 08:30:35 -0800 (PST) Received: from rfranz-i7.local (c-24-10-97-91.hsd1.ca.comcast.net. [24.10.97.91]) by mx.google.com with ESMTPSA id nw11sm23388124pab.13.2014.01.10.08.30.33 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 10 Jan 2014 08:30:34 -0800 (PST) From: Roy Franz To: linux-kernel@vger.kernel.org, linux-efi@vger.kernel.org, linux-arm-kernel@lists.infradead.org, matt.fleming@intel.com, linux@arm.linux.org.uk Subject: [PATCH V6 5/8] Add strstr to compressed string.c for ARM. Date: Fri, 10 Jan 2014 08:30:14 -0800 Message-Id: <1389371417-379-6-git-send-email-roy.franz@linaro.org> X-Mailer: git-send-email 1.7.10.4 In-Reply-To: <1389371417-379-1-git-send-email-roy.franz@linaro.org> References: <1389371417-379-1-git-send-email-roy.franz@linaro.org> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20140110_113058_093783_542EC605 X-CRM114-Status: GOOD ( 11.32 ) X-Spam-Score: -2.6 (--) Cc: patches@linaro.org, leif.lindholm@linaro.org, Roy Franz , msalter@redhat.com, grant.likely@linaro.org, dave.martin@arm.com 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.3 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 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 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)