Received: by 2002:ac0:bc90:0:0:0:0:0 with SMTP id a16csp3620677img; Mon, 25 Mar 2019 14:09:57 -0700 (PDT) X-Google-Smtp-Source: APXvYqwOVec8u6Bh37ve5tG+a7zM0hgmQAjFWLrzNKb7NtDJJSchIp+qSivCK8twwJJH+0YFDUKV X-Received: by 2002:a63:fc43:: with SMTP id r3mr7847596pgk.44.1553548197318; Mon, 25 Mar 2019 14:09:57 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1553548197; cv=none; d=google.com; s=arc-20160816; b=DKy3hzXoKyiuX8RH1Oqu9cmPh4sYSlB4/QpjyVO5aIs9If1GPn4DLAthawAhXtUzWo 7PwNcOvPFrX17CNaTGM+V6cR2A1l6J8KrB72gHs6++XYLdx4ftFink3Oa9w5FCLYLtWS HjSGIWzkc9tiOHlSYeLxuPqm9vO9ANDdn/NvSNxDhIzcL44RSGJxcxskAf9PQVcj+aFB UrHhcdJIOFLxzAw3kE3cDNnbYGaMkOaGU4W3L2yJFGftxHSk839GuBuZLs7vig744bUS zs3sldsY+f0j284pqLuffF9ntJT6bm76prXxZQQCuJeHFs9YN38uObJPX/BwbivvwesI Fcmw== 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=oaWjWynZcP4S+of7lFzqgkmf6JN8m0lZ+nlqGdz1pqWCytcB3UICV8lFDIlFYMk6LC PrftaPpwYE0KtcWBhkZ8qK1z1axxhk25Qz5JTA0mlzDT9Y/8Q0fSEN7UawK2ER2XcnXz O3lM0xT+6WSRX+qFyPsqKiE7t7EFkV5xSyC9u7Iz5mpzNfyc0NOn9cIe5IUJBsh0sy7H 6V4sBd/zWPJx6iiD5n3omruzUqdUgvF0Oyq6+rTKe2vcSZSYK+Tx0SJATq/e+P+6rBwW Zrw3wWHiOrqY7UbmZXuiPsz8oVOlP8PnwT0QqOIHRRjXO5I3YzeQ0v3Xq+peKF9wOWa/ AQ+g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b="Y/L7fBIy"; 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 o1si14103483pgk.582.2019.03.25.14.09.41; Mon, 25 Mar 2019 14:09:57 -0700 (PDT) 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="Y/L7fBIy"; 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 S1730301AbfCYVHz (ORCPT + 99 others); Mon, 25 Mar 2019 17:07:55 -0400 Received: from mail-pl1-f195.google.com ([209.85.214.195]:39617 "EHLO mail-pl1-f195.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729283AbfCYVHz (ORCPT ); Mon, 25 Mar 2019 17:07:55 -0400 Received: by mail-pl1-f195.google.com with SMTP id b65so533146plb.6 for ; Mon, 25 Mar 2019 14:07:54 -0700 (PDT) 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=Y/L7fBIyCvQVXA2Gh8cfgQKCSNKy8V5VYDvwr9S2ZdcA2mKRtO1DvozM7pcKG2Yt4B rL3ozkYN7QofFFTQ+BZTxphMZRrl5tYk2ZHzv9WfyM19HxmjEHwwWvaPYVFy/zahYKh8 Na9oFPFfF2wGuWpliwYujMWUI9Gi4f7x3HVATi02A6p3N3PbxoNOVyuImUKEP91uWwxI 7/z/NAILmUAVcH6mJf+yVpHMCHqI8xQ5893fSkB4gB1K1J01pC0Ftrbh3swNrSzcCjlH vrXdUkUsEkQfOGctzl15AI9PfNLpuSg00eHOxaqg/LdlwH7Qes//fFAWLO1OP2e7G9+x /6CQ== 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=tS5r+9IvgbuqPTp8Z0cQi/RRqn1YSmTPi4YEzBNBFJLHkMrujnrl2YiNrO0omlYqnu Uqla3QUUQ0HOC90R7dNie6lKJPxNMvKcCDY9TAizLTxuerNIlJv9p9I64LdeNRh/SOvw 8/z7HdvOAvLaxpayj3d2Fp1UEB2xyb2ZjznNaLtX0a07VrOxj5ElIiUU10IEZ64QEOX3 uoHIuRBVtDRltiEG5tAMbb4Q1j7g6ds+PfwW+bjC7jfolMasoEdHZhGoRbJ/l9ZffMAB /1bPChaLdfu/7sr71vlNUwIWzkvSTP5okVHxLeJKO+aHeVKbcqcQBKcueORDSt4Wh7K3 42rw== X-Gm-Message-State: APjAAAX53Vz66leKdR90g/4i7bVlkL/Cfnn/qpWrZ3tnJLvdRGnO1hU7 G7yzmX9B0ATl2+z3Kmm42Jc= X-Received: by 2002:a17:902:2702:: with SMTP id c2mr27140927plb.239.1553548074313; Mon, 25 Mar 2019 14:07:54 -0700 (PDT) Received: from localhost ([169.229.22.206]) by smtp.gmail.com with ESMTPSA id h184sm35239882pfc.78.2019.03.25.14.07.53 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Mon, 25 Mar 2019 14:07:53 -0700 (PDT) From: Yury Norov X-Google-Original-From: Yury Norov To: Andrew Morton , Andy Shevchenko , Rasmus Villemoes , Arnd Bergmann , Kees Cook , Matthew Wilcox , Tetsuo Handa Cc: Yury Norov , Yury Norov , linux-kernel@vger.kernel.org Subject: [PATCH 1/6] bitmap_parselist: don't calculate length of the input string Date: Tue, 26 Mar 2019 00:07:43 +0300 Message-Id: <20190325210748.6571-2-ynorov@marvell.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20190325210748.6571-1-ynorov@marvell.com> References: <20190325210748.6571-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