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: 23097 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-pb0-f69.google.com (mail-pb0-f69.google.com [209.85.160.69]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id A74BD216DB for ; Fri, 10 Jan 2014 16:30:55 +0000 (UTC) Received: by mail-pb0-f69.google.com with SMTP id md12sf10722119pbc.0 for ; Fri, 10 Jan 2014 08:30:54 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:delivered-to:from:to:cc:subject :date:message-id:in-reply-to:references:x-original-sender :x-original-authentication-results:precedence:mailing-list:list-id :list-post:list-help:list-archive:list-unsubscribe; bh=lIrSEzt2HO0U7tP6JCBQpvdrX0GZZ4VHoOUzKXCFow4=; b=LLob1NCeIvw4GOZVAHplQghHx+cgeWMlxSceg0BFNfw3yiq6hEWI0I4p1Or6iRoRXu Ev62WpSCE1LKaen+3ZeH4ORDhmcgUVLXApeNkH6zz3dkcC9fb9ZMSfJlIZdQ+ChpLLgL eJQQ1w0zs90rWQzhCHjxI5gCB9mnDgAZD3RgEM8V50LDLLR3Kx8erKlHi4zF4EKdklpV ZvQzRKl5WSPryxSShFAIfyQdoYX6txs4frgU//NW5yzG8vAS3cbdDPgTfPR3m6qZSqM7 m1bZ8FPyFH002Rtmr/4UJKd7oYVbs4sKBYSpI16L9jRR2tShnTNVro7+o0eZ0UppjuhK 8cjg== X-Gm-Message-State: ALoCoQllWtFPunzlrkd6aOUx2cHMFNt8E5OcxOsfG0B2lt1Feg3cMssf1jK5D3t7RaNsm91Z4+0i X-Received: by 10.66.66.163 with SMTP id g3mr3765225pat.3.1389371454953; Fri, 10 Jan 2014 08:30:54 -0800 (PST) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.49.106.102 with SMTP id gt6ls1541613qeb.78.gmail; Fri, 10 Jan 2014 08:30:54 -0800 (PST) X-Received: by 10.52.158.170 with SMTP id wv10mr112609vdb.77.1389371454803; Fri, 10 Jan 2014 08:30:54 -0800 (PST) Received: from mail-ve0-f182.google.com (mail-ve0-f182.google.com [209.85.128.182]) by mx.google.com with ESMTPS id q10si5267801ves.20.2014.01.10.08.30.54 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Fri, 10 Jan 2014 08:30:54 -0800 (PST) Received-SPF: neutral (google.com: 209.85.128.182 is neither permitted nor denied by best guess record for domain of patch+caf_=patchwork-forward=linaro.org@linaro.org) client-ip=209.85.128.182; Received: by mail-ve0-f182.google.com with SMTP id jy13so3627086veb.41 for ; Fri, 10 Jan 2014 08:30:54 -0800 (PST) X-Received: by 10.58.146.5 with SMTP id sy5mr2827801veb.43.1389371454654; Fri, 10 Jan 2014 08:30:54 -0800 (PST) X-Forwarded-To: patchwork-forward@linaro.org X-Forwarded-For: patch@linaro.org patchwork-forward@linaro.org Delivered-To: patches@linaro.org Received: by 10.59.13.131 with SMTP id ey3csp100847ved; Fri, 10 Jan 2014 08:30:53 -0800 (PST) X-Received: by 10.67.14.231 with SMTP id fj7mr12242757pad.115.1389371437063; Fri, 10 Jan 2014 08:30:37 -0800 (PST) Received: from mail-pd0-f170.google.com (mail-pd0-f170.google.com [209.85.192.170]) by mx.google.com with ESMTPS id dv5si7658357pbb.13.2014.01.10.08.30.36 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Fri, 10 Jan 2014 08:30:37 -0800 (PST) Received-SPF: neutral (google.com: 209.85.192.170 is neither permitted nor denied by best guess record for domain of roy.franz@linaro.org) client-ip=209.85.192.170; Received: by mail-pd0-f170.google.com with SMTP id g10so4767153pdj.15 for ; Fri, 10 Jan 2014 08:30:36 -0800 (PST) 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 Cc: leif.lindholm@linaro.org, grant.likely@linaro.org, dave.martin@arm.com, msalter@redhat.com, patches@linaro.org, Roy Franz 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-Removed-Original-Auth: Dkim didn't pass. X-Original-Sender: roy.franz@linaro.org X-Original-Authentication-Results: mx.google.com; spf=neutral (google.com: 209.85.128.182 is neither permitted nor denied by best guess record for domain of patch+caf_=patchwork-forward=linaro.org@linaro.org) smtp.mail=patch+caf_=patchwork-forward=linaro.org@linaro.org Precedence: list Mailing-list: list patchwork-forward@linaro.org; contact patchwork-forward+owners@linaro.org List-ID: X-Google-Group-Id: 836684582541 List-Post: , List-Help: , List-Archive: List-Unsubscribe: , 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)