Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp2828353imu; Sun, 23 Dec 2018 08:42:06 -0800 (PST) X-Google-Smtp-Source: ALg8bN7hjba64d7QLF9soq6X1baV7uPksHNQC4mtcMHQcCR+pUG9WgSUF0ABncWJZV6jM7rraMy5 X-Received: by 2002:a17:902:7005:: with SMTP id y5mr10213335plk.7.1545583326904; Sun, 23 Dec 2018 08:42:06 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1545583326; cv=none; d=google.com; s=arc-20160816; b=inIxdvGjiaOEApuLQhe03SFYJ0dFWTsuhaJ0g17b3+rPbtABDcBIJim4Kx0FwL82p1 McVDye4zTGVSiGBrXiK0K7kqQEkbDorXVcjMYmLgSS0h+bDU5guR9/JH1P1lqsugGpb3 nEc+6zgCa7rlPpoY/2x2o49OPAxK/awY3TZ9YcKWzsHaoHguEeiF+tygELyNPsz+QiXK hxhTVcgja4xIDHse0PVDnjH5YYOAMXJYQDL9NCGgoXvl4yhTIm1rYi2oKrUvcA1rVJRR 7GhM7LxFTn/v9DazWGzunF0R32GuwrWFV0w/oiluKs1bB60jA8nIrf7kefduHQwJ5al3 g+zQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:content-transfer-encoding :spamdiagnosticmetadata:spamdiagnosticoutput:content-language :accept-language:in-reply-to:references:message-id:date:thread-index :thread-topic:subject:cc:to:from:dkim-signature:dkim-signature; bh=wcyGKt6uaD41GgP+udegyJGkcibB7zysOJHFBKraRbE=; b=QxMsfyEUdUbyVnrqbkj3G8hK7mtU2st+p1lBa/8+IfU9aXWFtPPpMCQzd/o1Xf/EDb w0xWuGbXIuXGUJILyNqJsVxPVLPCBjMSUeLI/OsTPzQjWdn3fzBbbmQabLI6NgetyxjH JTmVtX58cx9retrmN+vadxAbFZzNbLZjfY7H57tvvS/kKmO9SVLZqUJx8zgoQ+IHdeVN 3j63/qsY3F1+dmN9AHTdJmj5fDJUo1/x+/3+bfjUtMGHrf0qBl4FNXoACxo8YHD+jIB6 GHv6kFxvIn9JK7WQ4S0MFyOtsqj4klcju0sBW7YcUCcD75J91vu5oed7VmgJWojBslsz jr4w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@marvell.com header.s=pfpt0818 header.b=TbdpGcrG; dkim=pass header.i=@marvell.onmicrosoft.com header.s=selector1-marvell-com header.b="Vk/3Yjmz"; 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=NONE dis=NONE) header.from=marvell.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id l5si24602523plt.5.2018.12.23.08.41.51; Sun, 23 Dec 2018 08:42:06 -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=@marvell.com header.s=pfpt0818 header.b=TbdpGcrG; dkim=pass header.i=@marvell.onmicrosoft.com header.s=selector1-marvell-com header.b="Vk/3Yjmz"; 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=NONE dis=NONE) header.from=marvell.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727532AbeLWJqF (ORCPT + 99 others); Sun, 23 Dec 2018 04:46:05 -0500 Received: from mx0b-0016f401.pphosted.com ([67.231.156.173]:37458 "EHLO mx0b-0016f401.pphosted.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725847AbeLWJqF (ORCPT ); Sun, 23 Dec 2018 04:46:05 -0500 Received: from pps.filterd (m0045851.ppops.net [127.0.0.1]) by mx0b-0016f401.pphosted.com (8.16.0.27/8.16.0.27) with SMTP id wBN9e3lX011914; Sun, 23 Dec 2018 01:44:42 -0800 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=marvell.com; h=from : to : cc : subject : date : message-id : references : in-reply-to : content-type : content-transfer-encoding : mime-version; s=pfpt0818; bh=wcyGKt6uaD41GgP+udegyJGkcibB7zysOJHFBKraRbE=; b=TbdpGcrGr/4lTE2p9GI4yjtG/GnFUw6RooA2ryYsq9RhcZuMLFCTf9l16iWsInP0yrZC maWuzYSilHzdeJWmXq7d7+fQuZI7ZzVrCuA5Ypfr9hyjESlFY+Gnk3cxgSE/SMzEMRnc 74h4nT37Mi74f/CW8wlccu+kQqmCRKCXylJro3UUXxxZMq4achczmx2eoiCdGEXPUZkb S+SLsU9Deq/b7h9tWjhQ42Zw0prAIT7XSAKl4pMHlhY617fU9qZipHxF28z7bmQ5mURG v7txWQTC8TZrFTvRfiwb+7aktkLu9Yu78+Fh6Viq+jRtBtqu7kZwcpXjRC3EOoSt+j3K WQ== Received: from sc-exch02.marvell.com ([199.233.58.182]) by mx0b-0016f401.pphosted.com with ESMTP id 2phnnqbevc-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-SHA384 bits=256 verify=NOT); Sun, 23 Dec 2018 01:44:42 -0800 Received: from SC-EXCH02.marvell.com (10.93.176.82) by SC-EXCH02.marvell.com (10.93.176.82) with Microsoft SMTP Server (TLS) id 15.0.1367.3; Sun, 23 Dec 2018 01:44:41 -0800 Received: from NAM05-BY2-obe.outbound.protection.outlook.com (104.47.50.57) by SC-EXCH02.marvell.com (10.93.176.82) with Microsoft SMTP Server (TLS) id 15.0.1367.3 via Frontend Transport; Sun, 23 Dec 2018 01:44:41 -0800 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=marvell.onmicrosoft.com; s=selector1-marvell-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=wcyGKt6uaD41GgP+udegyJGkcibB7zysOJHFBKraRbE=; b=Vk/3YjmzBXBbeifG3UiEghzo8PzbfQQuU9Pnl7JGG+fHykMaS8Xc+fB3/i368MC8F9rbFzLvfmf/QdU6V0HFWiwXJYy5L+Acv3YPnjcPF0m8TDET2xdzZTdMDBJVTmIVs/bZyhfrNOMe3I+5cf5oFJ5Gu8mhmwAdFBqm6JwmqPs= Received: from BYAPR18MB2888.namprd18.prod.outlook.com (20.179.58.203) by BYAPR18MB2904.namprd18.prod.outlook.com (20.179.58.219) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.1446.17; Sun, 23 Dec 2018 09:44:40 +0000 Received: from BYAPR18MB2888.namprd18.prod.outlook.com ([fe80::c1de:fdbc:577e:ac65]) by BYAPR18MB2888.namprd18.prod.outlook.com ([fe80::c1de:fdbc:577e:ac65%3]) with mapi id 15.20.1446.026; Sun, 23 Dec 2018 09:44:40 +0000 From: Yuri Norov To: Andrew Morton , Andy Shevchenko , Rasmus Villemoes , Arnd Bergmann , Kees Cook , Matthew Wilcox , Tetsuo Handa CC: Yuri Norov , "linux-kernel@vger.kernel.org" Subject: [PATCH 1/4] bitmap_parselist: don't calculate length of the input string Thread-Topic: [PATCH 1/4] bitmap_parselist: don't calculate length of the input string Thread-Index: AQHUmqQfrA6xn2nAj0yLIRPgzAZ/tw== Date: Sun, 23 Dec 2018 09:44:39 +0000 Message-ID: <20181223094422.4849-2-ynorov@marvell.com> References: <20181223094422.4849-1-ynorov@marvell.com> In-Reply-To: <20181223094422.4849-1-ynorov@marvell.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-clientproxiedby: VI1P189CA0021.EURP189.PROD.OUTLOOK.COM (2603:10a6:802:2a::34) To BYAPR18MB2888.namprd18.prod.outlook.com (2603:10b6:a03:10d::11) x-ms-exchange-messagesentrepresentingtype: 1 x-originating-ip: [212.58.114.41] x-ms-publictraffictype: Email x-microsoft-exchange-diagnostics: 1;BYAPR18MB2904;20:a5m5xLhM0+qye7WqhL6sIh+Ycus6s9G9bJVaVds4y/nZ/dZPWaJyZUKYv9TAo0BBPkbLw+qGYPKaZvCjpAJ02Ls2KEreeiLnavvc32jBlc1M84Tz16E/TUpQcNgSSBI0ACfmPPqv/CLRU92IWMIuSLr3yIZu4qCIEQ8r0amCSVI= x-ms-office365-filtering-correlation-id: 401f187d-5839-4122-25d6-08d668bb4218 x-microsoft-antispam: BCL:0;PCL:0;RULEID:(2390118)(7020095)(4652040)(8989299)(5600074)(711020)(4534185)(4627221)(201703031133081)(201702281549075)(8990200)(2017052603328)(7153060)(7193020);SRVR:BYAPR18MB2904; x-ms-traffictypediagnostic: BYAPR18MB2904: x-microsoft-antispam-prvs: x-exchange-antispam-report-cfa-test: BCL:0;PCL:0;RULEID:(8211001083)(3230021)(908002)(999002)(5005026)(6040522)(2401047)(8121501046)(93006095)(93001095)(10201501046)(3231475)(944501520)(52105112)(3002001)(6041310)(20161123560045)(20161123562045)(20161123564045)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(20161123558120)(201708071742011)(7699051)(76991095);SRVR:BYAPR18MB2904;BCL:0;PCL:0;RULEID:;SRVR:BYAPR18MB2904; x-forefront-prvs: 0895DF8FFD x-forefront-antispam-report: SFV:NSPM;SFS:(10009020)(346002)(366004)(39850400004)(376002)(136003)(396003)(199004)(189003)(71200400001)(53936002)(99286004)(71190400001)(5660300001)(86362001)(478600001)(97736004)(476003)(2616005)(1076003)(316002)(68736007)(11346002)(2906002)(446003)(36756003)(256004)(14454004)(66066001)(110136005)(305945005)(102836004)(8936002)(7736002)(386003)(6506007)(6486002)(186003)(105586002)(26005)(25786009)(6512007)(54906003)(8676002)(52116002)(106356001)(3846002)(6116002)(76176011)(81166006)(81156014)(486006)(6436002)(4326008);DIR:OUT;SFP:1101;SCL:1;SRVR:BYAPR18MB2904;H:BYAPR18MB2888.namprd18.prod.outlook.com;FPR:;SPF:None;LANG:en;PTR:InfoNoRecords;A:1;MX:1; received-spf: None (protection.outlook.com: marvell.com does not designate permitted sender hosts) x-ms-exchange-senderadcheck: 1 x-microsoft-antispam-message-info: sDxQpRe2fHYOMPhimw3kV6kXk+gJBXZESTnKm80taJQ1bNOetiHbHiF5rNn06CMabktYZWIlKRCcEnV/iI4MnhKX32CNY082G4U9NQVF8dNj5vPoAujtkcVjkcBiX4iI6eNT9AG9sSIO6pl3hZHrj2+iMj1MewA6gqmiOJzMrvnf/woISzyf7fsAMK8oeXM0gfANOW0oqNaThdc8Z+t2VOwO5jiLS4p9Qfhl4W+VYJ0Ts/ixVtbD7huZM8+B5heZTYFL5B43zJPpnlU3LBYJHfwq3aGsH5f3eEatjzkk8hZ0bZfG7g3buwf36mfzx0GA spamdiagnosticoutput: 1:99 spamdiagnosticmetadata: NSPM Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-MS-Exchange-CrossTenant-Network-Message-Id: 401f187d-5839-4122-25d6-08d668bb4218 X-MS-Exchange-CrossTenant-originalarrivaltime: 23 Dec 2018 09:44:40.0305 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 70e1fb47-1155-421d-87fc-2e58f638b6e0 X-MS-Exchange-Transport-CrossTenantHeadersStamped: BYAPR18MB2904 X-OriginatorOrg: marvell.com X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:,, definitions=2018-12-23_07:,, signatures=0 X-Proofpoint-Details: rule=outbound_notspam policy=outbound score=0 priorityscore=1501 malwarescore=0 suspectscore=0 phishscore=0 bulkscore=0 spamscore=0 clxscore=1015 lowpriorityscore=0 mlxscore=0 impostorscore=0 mlxlogscore=657 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1810050000 definitions=main-1812230086 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 eead55aa7170..ad43ba397c58 100644 --- a/lib/bitmap.c +++ b/lib/bitmap.c @@ -614,10 +614,7 @@ static int __bitmap_parselist(const char *buf, unsigne= d int buflen, =20 int bitmap_parselist(const char *bp, unsigned long *maskp, int nmaskbits) { - char *nl =3D strchrnul(bp, '\n'); - int len =3D nl - bp; - - return __bitmap_parselist(bp, len, 0, maskp, nmaskbits); + return __bitmap_parselist(bp, UINT_MAX, 0, maskp, nmaskbits); } EXPORT_SYMBOL(bitmap_parselist); =20 --=20 2.17.1