From patchwork Thu Feb 11 23:06:34 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Rob Herring (Arm)" X-Patchwork-Id: 8285521 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.29.136]) by patchwork2.web.kernel.org (Postfix) with ESMTP id EEB0DBEEE5 for ; Thu, 11 Feb 2016 23:08:49 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id EAF1720270 for ; Thu, 11 Feb 2016 23:08:48 +0000 (UTC) Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.9]) (using TLSv1.2 with cipher AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 16EF42026C for ; Thu, 11 Feb 2016 23:08:48 +0000 (UTC) Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.80.1 #2 (Red Hat Linux)) id 1aU0KG-0005q1-Rk; Thu, 11 Feb 2016 23:07:04 +0000 Received: from mail-oi0-f53.google.com ([209.85.218.53]) by bombadil.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1aU0KC-0005mS-Ee for linux-arm-kernel@lists.infradead.org; Thu, 11 Feb 2016 23:07:01 +0000 Received: by mail-oi0-f53.google.com with SMTP id m82so841821oif.1 for ; Thu, 11 Feb 2016 15:06:39 -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; bh=eeanZ9ltOrVyKApQklEVrjnN03DqIK9njumH33o6y0Y=; b=BPmDunzSHLYFNh9L59bOdvtTJp7rY/V4UukqHHM/WMV9ds+JEQmjSAuYroA+NMgEfr aK8Ut4up3i6mTp9RJZEEuFkD2tjmo9VGmMO+t9652ARzUbUse2cKDwV+sFv5PZDzGiDV m01B7OQdPhgNiWQf9lHsBvUYIkQRIZDOlTrwPoTJswx40Jg/IR2wiGPxHgPaG5yYcU0x nNmbbFYPLBVPgv34oejaGWOrAvBuCskm1QQwJOlS0YdknLMlvGZ3X6uDJzMZRMwoeykX uXV5CbMXbMq6ueT0ptZpG9yJfM0gZOrj+6Ompblk2BF5jL9OnQ6W7sf8Ceb7/wQ2GTko GCpg== X-Gm-Message-State: AG10YOTmqmuIl15y4pLxOGTbtVwvaFdV6U1YBpMTRPdEm05+dTD3N8IfAcg1bTvAzLjXcw== X-Received: by 10.202.2.8 with SMTP id 8mr221799oic.80.1455231999292; Thu, 11 Feb 2016 15:06:39 -0800 (PST) Received: from rob-hp-laptop.herring.priv (72-48-98-129.dyn.grandenetworks.net. [72.48.98.129]) by smtp.googlemail.com with ESMTPSA id zv7sm2200436obc.13.2016.02.11.15.06.38 (version=TLSv1/SSLv3 cipher=OTHER); Thu, 11 Feb 2016 15:06:38 -0800 (PST) From: Rob Herring To: Russell King Subject: [PATCH] ARM: boot: Add an implementation of strnlen for libfdt Date: Thu, 11 Feb 2016 17:06:34 -0600 Message-Id: <1455231994-12048-1-git-send-email-robh@kernel.org> X-Mailer: git-send-email 2.5.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20160211_150700_599144_FB69639B X-CRM114-Status: GOOD ( 10.99 ) X-Spam-Score: -2.4 (--) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: linux-arm-kernel@lists.infradead.org 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.4 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 Recent versions of libfdt add a dependency on strnlen. Copy the implementation in lib/string.c here, so we can update libfdt. Signed-off-by: Rob Herring Acked-by: Russell King --- Russell, I have a pending libfdt update, so I'd like to take this thru the DT tree with your ack. Rob arch/arm/boot/compressed/string.c | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/arch/arm/boot/compressed/string.c b/arch/arm/boot/compressed/string.c index 36e53ef..6894674 100644 --- a/arch/arm/boot/compressed/string.c +++ b/arch/arm/boot/compressed/string.c @@ -65,6 +65,15 @@ size_t strlen(const char *s) return sc - s; } +size_t strnlen(const char *s, size_t count) +{ + const char *sc; + + for (sc = s; count-- && *sc != '\0'; ++sc) + /* nothing */; + return sc - s; +} + int memcmp(const void *cs, const void *ct, size_t count) { const unsigned char *su1 = cs, *su2 = ct, *end = su1 + count;