Received: by 2002:ac0:a679:0:0:0:0:0 with SMTP id p54csp326282imp; Wed, 20 Feb 2019 00:37:53 -0800 (PST) X-Google-Smtp-Source: AHgI3Iax+SPLPd8B8BdKoNLxioubDcEcQpPPPKJf0To5fphj7BMeMb1vmDhCzxCtcwgeKC1GEC3h X-Received: by 2002:a17:902:b101:: with SMTP id q1mr35517511plr.135.1550651873885; Wed, 20 Feb 2019 00:37:53 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1550651873; cv=none; d=google.com; s=arc-20160816; b=btv7RDCbg/YWKnB/6ZmlXpiofHyxJfKCqPUAyYo0k/AUqus9Z3/4II5zJ7sdVo801L DTV+3J593ftCp7sTSABb02LdNfIBljKdUSBdJMDxC24cqY+tsLeY4QP7lkW02YJmh/ab iOrOIlcIXA1hjduJLQGu3mRaO+ccBZe6lEc1uVXnzWytRDoGlYT/76U9CMkoZ6/iG659 MwmWXOknaZ8njlBGca1c8YVlmHyEckL80RgDK4PO9qp/1kNZoLpoyWFnxQB7ot6aATIl vBL3gcP8I0EU7lZXAE7C7p6xQ3NQ3rtdDZzKYN0daR8hBRlLt2I87f+trFyYEmOoyFbp 7Mdg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from:dkim-signature; bh=tBj//QOlOyjUJzu3wlOuk95ckvdPlbdm8RVV0pjJRDw=; b=tChL6Uxiwq5vQ5+R80IQxO6gmRY4nJVOCXmmwHk4VRqsWzAyEHBDSMYIbi9JQi+3Ia 8JB64AsrpOIQiwBqUlkjsjbDyrKmw2Oe2eDr1pLTE08to7I1Fro9mqCiaPi+3V5xoqoO mVQOL2xmcKY97i9gCWMGaJUbenFMboyGfWemrXFdeHne+VmNVlSZ3cj/sG4ppy+Z+/tE ydJ4I7jGaM7eUFUxPdqmInJE1uXu5nhap1kU2rrYEB+349hrxU8vN3W+3hU8wMDQn1oG RURGmTPBgI9V8kOFeknlZyBVcrCrLpqq92tgt8evkX4wy3pZltT9P4ZxwM3IIIoNalAL fvHA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=a3lonrAS; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id a8si16654208pgt.326.2019.02.20.00.37.38; Wed, 20 Feb 2019 00:37:53 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=a3lonrAS; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726332AbfBTIhR (ORCPT + 99 others); Wed, 20 Feb 2019 03:37:17 -0500 Received: from mail-lf1-f65.google.com ([209.85.167.65]:40823 "EHLO mail-lf1-f65.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725846AbfBTIhO (ORCPT ); Wed, 20 Feb 2019 03:37:14 -0500 Received: by mail-lf1-f65.google.com with SMTP id t14so16926261lfk.7 for ; Wed, 20 Feb 2019 00:37:14 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=tBj//QOlOyjUJzu3wlOuk95ckvdPlbdm8RVV0pjJRDw=; b=a3lonrAS40uoTQfSOuKHsMVc5OKd5ZbWNpSazXSzDxqigEzJ4AOoe8kmhPgfVNLtxy Ifq7ZJ1Ie9sKFCdhn0h8lw5znN5TEzGd50gxlrtMbVO1adoAd2ypqsrwFjLzHX91Ukww HsklqLKaCWtBRa9mmzc2EdN60hV8Sf4fd5s4hr9x/4mGvkOPBEJoklXVvNrleSEhDkyC yH4KnO4BhkchQCBEh9ZLl/TI5neexA+u2xSTeJ8IB/M+Ur+GZdnQkhpTTy5E70Us2kvH 9HRKn7kxhaKBlzfU+XVIHYMQv2k1TiCU8XMY3tpXCD86VmJpkk0uhUP8eQUk2+EEr/wY d8Yg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=tBj//QOlOyjUJzu3wlOuk95ckvdPlbdm8RVV0pjJRDw=; b=h1cgwtM6spKRmW7yuYoYypA48iMYewybXTZJgBAdM9lNFYf5mGSlGBAmOdKSKwzgDM PdG/3BBW0YpkKpFRla1vWSbxJT7IaDrAnvtLafoIW/oITnpnXky8Ep0IQrglxJCllgpN i/ooxLeaeqjAKqXz3ZNdk5gqJmsGC9ees7JV5yXf4JyoUotb6UWIW/x0oQPgTAwO6xO0 GWGwY83jpNitU78pSsBMvqlIYX1wTsHzUoPFVRAq4s5ZHCEf9l/7OU7D6tuwoQPmxbvi HodgvE7B68oM/e+CJplkRRQ/Yf5/UufT1/F23YSAIG235wbojD8l8hTc9WBJJpvTSrhf 7EGg== X-Gm-Message-State: AHQUAua7GAcT6Ex+QcW+s95dJYJIvDJjEPJCXWUqtPmUjaU2n2AkdbDm 099VrWXmfZFbXkxctKG/5KM= X-Received: by 2002:a19:c116:: with SMTP id r22mr19504519lff.32.1550651833049; Wed, 20 Feb 2019 00:37:13 -0800 (PST) Received: from localhost ([188.162.52.148]) by smtp.gmail.com with ESMTPSA id k124sm1115781lfg.95.2019.02.20.00.37.11 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Wed, 20 Feb 2019 00:37:12 -0800 (PST) From: Yury Norov X-Google-Original-From: Yury Norov To: Andrew Morton , Andy Shevchenko , Arnd Bergmann , Dmitry Torokhov , Kees Cook , Matthew Wilcox , Michael Ellerman , Rasmus Villemoes , Tetsuo Handa Cc: Yury Norov , linux-kernel@vger.kernel.org, Yury Norov Subject: [PATCH 1/6] bitmap_parselist: don't calculate length of the input string Date: Wed, 20 Feb 2019 11:37:00 +0300 Message-Id: <20190220083705.14050-2-ynorov@marvell.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20190220083705.14050-1-ynorov@marvell.com> References: <20190220083705.14050-1-ynorov@marvell.com> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org bitmap_parselist() calculates length of the input string before passing it to the __bitmap_parselist(). But the end-of-line condition is checked for every character in __bitmap_parselist() anyway. So doing it in wrapper is a simple waste of time. Signed-off-by: Yury Norov --- lib/bitmap.c | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/lib/bitmap.c b/lib/bitmap.c index 98872e9025da..ad1fb7e6ad0e 100644 --- a/lib/bitmap.c +++ b/lib/bitmap.c @@ -614,10 +614,7 @@ static int __bitmap_parselist(const char *buf, unsigned int buflen, int bitmap_parselist(const char *bp, unsigned long *maskp, int nmaskbits) { - char *nl = strchrnul(bp, '\n'); - int len = nl - bp; - - return __bitmap_parselist(bp, len, 0, maskp, nmaskbits); + return __bitmap_parselist(bp, UINT_MAX, 0, maskp, nmaskbits); } EXPORT_SYMBOL(bitmap_parselist); -- 2.17.1