Received: by 2002:ac0:a594:0:0:0:0:0 with SMTP id m20-v6csp797952imm; Mon, 21 May 2018 14:40:20 -0700 (PDT) X-Google-Smtp-Source: AB8JxZqU6MK58xvUkCuMTlvKwa2jjzF0DTB6pifSKqxTS/4MXeSG2Ww5RY3NPXZLu5g55PMEEl7z X-Received: by 2002:a63:7d47:: with SMTP id m7-v6mr16996504pgn.443.1526938820387; Mon, 21 May 2018 14:40:20 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1526938820; cv=none; d=google.com; s=arc-20160816; b=uC+OSJVWcp15ElUt0kLdVcOX9c4TH1r7oVpOrMY33aBrcQ4GzCnJqSyqq1lnEk/oVg fNfp9X81a/0SuAgAmFDjxRRp7RugJW6FqQv7v/0QrB32t5hD5gmzTASFHI+2Y1vc/t70 0uI45PfZDzhsXYbiXkLzVWwywwXmaEMuYWPy6VQ1RgrdQOOYGMkQqxKG8UwmfvXcI5rw lI0QqTctYv+mSQ0GnkwOl+28hPtR3ml9/2Une/63lVoF+YKXVlTzxAHOGtDhwrZOD1HN xnPxlu9oXTYrCnab70k8qOgmPhKZh+T556Hhj28eOyrGei5RtRTZfc7WWTW5ql1xDXJY VeFg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:user-agent:references :in-reply-to:message-id:date:subject:cc:to:from:dkim-signature :arc-authentication-results; bh=1WSOpdBCeOBe52y9+5uKY/EmvTCX7Tbb0WXsXuBFu0M=; b=UufBDWseXESi6YVCJlffeVLh3vD+RoYdtvhjf0s1KbyiIlAbJQTzC7bpo71XN/1H4/ SXi9IFiy4NVLhUZ1x6lpY2pDSS7LTsgX9xTaAaocfOrNxvrjACoeLku1jKEUxYq53xKd R5fRRh9JwocdNGcDs0wWYhRh+jKrgbvEvfE5pSwnCYUZpBEQlk9rGiZ39HrL/5e4cghR DSC6N1Kn1SqKk2lezJFVpKFJJp0eAoNmTV79YnNVW3DLUOU9OJv7V7/MibU08KSRtRqr F8p28ju8lvdR6xUIrmFqeal47BqKMedzZWTk/NrvZMA7SC+HBug9iVSmuVd6XMOwJP33 2VDw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=w0M+eMl+; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id n20-v6si15013299pff.370.2018.05.21.14.40.06; Mon, 21 May 2018 14:40:20 -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=@kernel.org header.s=default header.b=w0M+eMl+; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754618AbeEUViv (ORCPT + 99 others); Mon, 21 May 2018 17:38:51 -0400 Received: from mail.kernel.org ([198.145.29.99]:39946 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754284AbeEUVZF (ORCPT ); Mon, 21 May 2018 17:25:05 -0400 Received: from localhost (LFbn-1-12247-202.w90-92.abo.wanadoo.fr [90.92.61.202]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id D7F7E2075C; Mon, 21 May 2018 21:25:03 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1526937904; bh=1bqwvBDCth8t7KwwE0Mu8WcegwgBDup/No6Uy2iVYx8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=w0M+eMl+/3+6J9LX3Af9UChnlaii7NAyDZHSzFhl9m2MUE0CdN5gzfIIVcnhtvvIu Q+yWzLpWxgCLLj5EEYWzeg8fQvNbEN7iqx2Maqb13yNuln0pPAzh3Sb480z/zsF2zG F6GizeUIdkkaBSoIJZbpjbSw44zOEDEI3qhuoEog= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Matthew Wilcox , Michael Ellerman , Kees Cook , Yury Norov , Andy Shevchenko , Geert Uytterhoeven , Andrew Morton , Linus Torvalds Subject: [PATCH 4.16 036/110] lib/test_bitmap.c: fix bitmap optimisation tests to report errors correctly Date: Mon, 21 May 2018 23:11:33 +0200 Message-Id: <20180521210506.912667866@linuxfoundation.org> X-Mailer: git-send-email 2.17.0 In-Reply-To: <20180521210503.823249477@linuxfoundation.org> References: <20180521210503.823249477@linuxfoundation.org> User-Agent: quilt/0.65 X-stable: review MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 4.16-stable review patch. If anyone has any objections, please let me know. ------------------ From: Matthew Wilcox commit 1e3054b98c5415d5cb5f8824fc33b548ae5644c3 upstream. I had neglected to increment the error counter when the tests failed, which made the tests noisy when they fail, but not actually return an error code. Link: http://lkml.kernel.org/r/20180509114328.9887-1-mpe@ellerman.id.au Fixes: 3cc78125a081 ("lib/test_bitmap.c: add optimisation tests") Signed-off-by: Matthew Wilcox Signed-off-by: Michael Ellerman Reported-by: Michael Ellerman Tested-by: Michael Ellerman Reviewed-by: Kees Cook Cc: Yury Norov Cc: Andy Shevchenko Cc: Geert Uytterhoeven Cc: [4.13+] Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds Signed-off-by: Greg Kroah-Hartman --- lib/test_bitmap.c | 21 +++++++++++++++------ 1 file changed, 15 insertions(+), 6 deletions(-) --- a/lib/test_bitmap.c +++ b/lib/test_bitmap.c @@ -329,23 +329,32 @@ static void noinline __init test_mem_opt unsigned int start, nbits; for (start = 0; start < 1024; start += 8) { - memset(bmap1, 0x5a, sizeof(bmap1)); - memset(bmap2, 0x5a, sizeof(bmap2)); for (nbits = 0; nbits < 1024 - start; nbits += 8) { + memset(bmap1, 0x5a, sizeof(bmap1)); + memset(bmap2, 0x5a, sizeof(bmap2)); + bitmap_set(bmap1, start, nbits); __bitmap_set(bmap2, start, nbits); - if (!bitmap_equal(bmap1, bmap2, 1024)) + if (!bitmap_equal(bmap1, bmap2, 1024)) { printk("set not equal %d %d\n", start, nbits); - if (!__bitmap_equal(bmap1, bmap2, 1024)) + failed_tests++; + } + if (!__bitmap_equal(bmap1, bmap2, 1024)) { printk("set not __equal %d %d\n", start, nbits); + failed_tests++; + } bitmap_clear(bmap1, start, nbits); __bitmap_clear(bmap2, start, nbits); - if (!bitmap_equal(bmap1, bmap2, 1024)) + if (!bitmap_equal(bmap1, bmap2, 1024)) { printk("clear not equal %d %d\n", start, nbits); - if (!__bitmap_equal(bmap1, bmap2, 1024)) + failed_tests++; + } + if (!__bitmap_equal(bmap1, bmap2, 1024)) { printk("clear not __equal %d %d\n", start, nbits); + failed_tests++; + } } } }