Received: by 2002:ac0:a5a7:0:0:0:0:0 with SMTP id m36-v6csp987242imm; Wed, 18 Jul 2018 14:25:37 -0700 (PDT) X-Google-Smtp-Source: AAOMgpccn4sGedx+ubgCfYJVm0grXZlzVV2XVvp14bGoaFRiSLsG3MkEgebBl3rHAZTNJc6LgI+n X-Received: by 2002:a17:902:82c7:: with SMTP id u7-v6mr7429102plz.83.1531949137498; Wed, 18 Jul 2018 14:25:37 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1531949137; cv=none; d=google.com; s=arc-20160816; b=rhwhSIl3Ag9F2xwmixI0UEUGVRTrW9qpPgQ0hn96c0vCqZLeSqO9ab11KO99zqXlwO ZfJsXxnN+e9q+3TAkSBz5xgjLAadI+SGq5uaWKWShLYGnU0gglvR9FLblAFVJdi+k2h9 SaP04rXPH+sspxYYGnsRl2dlV4WJXY6UmFG80oNj5NdZovozQsTkbIsnEB1q3pn54CMm ONRXL1VlSQz4dReTK0xzvYP4hZoTvaizBzhPpdCAcCfOwHg//a7FiMy3sNH2RJqDH3zd 2HEEgqAUHfdUKxN8lGCAT78XS1v4pWLIO5KbGg9nUP7AAwLVtuT9wuq0PiAdK9AOgir6 ZP3w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:message-id:subject:cc:to:from:date :arc-authentication-results; bh=3xVZ1dVcHHJ73tdA8NcmBoMbVDZMtey9LkPkBHP770E=; b=ag/h25PgS0lGrv/YHbhLuqVi9rPy5lgqITBcTnHw+zOcyPDAETYbCyzzka0VZW4ODg GYbDpHcBpw0rAU5cjIwzMEf2eEukzZs1AVMMl9rOYs+ppujvBjfhXVZeVCMLpxXnRawm msMIIRh9HE5CY5UY6oPSFdcGEssyorKwgMXgNxIEbrNYqw4mzhifqCRwWSlr/KFdb/uc ZPRZEjbd3wHLOf32jplKIo8Ed2UW1Skt1DcPswAQNj53PvD0KI4v2ZQH6k2K6pgt9QEx 5rwqY1W9OBOf0+3SB2HCdp5cynDBro10M5TCWGyDP6H0rLSQsAOmt74bk8qmeAJPQ16h b8JA== ARC-Authentication-Results: i=1; mx.google.com; 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 n4-v6si3851641plp.128.2018.07.18.14.25.22; Wed, 18 Jul 2018 14:25:37 -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; 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 S1730262AbeGRWE2 (ORCPT + 99 others); Wed, 18 Jul 2018 18:04:28 -0400 Received: from mail.linuxfoundation.org ([140.211.169.12]:42452 "EHLO mail.linuxfoundation.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729702AbeGRWE2 (ORCPT ); Wed, 18 Jul 2018 18:04:28 -0400 Received: from akpm3.svl.corp.google.com (unknown [104.133.9.92]) by mail.linuxfoundation.org (Postfix) with ESMTPSA id 642B0D37; Wed, 18 Jul 2018 21:24:15 +0000 (UTC) Date: Wed, 18 Jul 2018 14:24:14 -0700 From: Andrew Morton To: Coly Li Cc: linux-kernel@vger.kernel.org, linux-bcache@vger.kernel.org, linux-block@vger.kernel.org, Greg Kroah-Hartman , Linus Torvalds , Thomas Gleixner , Kate Stewart , Randy Dunlap , Andy Shevchenko , Noah Massey Subject: Re: [PATCH v4 3/3] lib/test_crc: Add test cases for crc calculation Message-Id: <20180718142414.1cab5d98b1f4b01102cd429a@linux-foundation.org> In-Reply-To: <20180718165545.1622-4-colyli@suse.de> References: <20180718165545.1622-1-colyli@suse.de> <20180718165545.1622-4-colyli@suse.de> X-Mailer: Sylpheed 3.6.0 (GTK+ 2.24.31; x86_64-pc-linux-gnu) Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, 19 Jul 2018 00:55:45 +0800 Coly Li wrote: > This patch adds a kernel module to test the consistency of multiple crc > calculation in Linux kernel. It is enabled with CONFIG_TEST_CRC enabled. > > The test results are printed into kernel message, which look like, > > test_crc: crc64_be: FAILED (0x03d4d0d85685d9a1, expected 0x3d4d0d85685d9a1f) > > kernel 0day system has framework to check kernel message, then the above > result can be handled by 0day system. If crc calculation inconsistency > happens, it can be detected quite soon. > > lib/test_crc.c is a testing frame work for many crc consistency > testings. For now, there is only one test caes for crc64_be(). Some tweaks. From: Andrew Morton Subject: lib-test_crc-add-test-cases-for-crc-calculation-fix make two globals static, regularize code layout, remove unneeded initialization Cc: Coly Li Signed-off-by: Andrew Morton --- lib/test_crc.c | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff -puN lib/test_crc.c~lib-test_crc-add-test-cases-for-crc-calculation-fix lib/test_crc.c --- a/lib/test_crc.c~lib-test_crc-add-test-cases-for-crc-calculation-fix +++ a/lib/test_crc.c @@ -25,8 +25,8 @@ struct crc_test_record { void (*handler)(struct crc_test_record *rec); }; -int failed_tests; -int total_tests; +static int failed_tests; +static int total_tests; static void chk_and_msg(const char *name, u64 crc, u64 expval) { @@ -68,9 +68,6 @@ static int __init test_crc_init(void) { int i; - failed_tests = 0; - total_tests = 0; - pr_info("Kernel CRC consistency testing:\n"); for (i = 0; test_data[i].name; i++) test_data[i].handler(&test_data[i]); @@ -85,7 +82,9 @@ static int __init test_crc_init(void) } late_initcall(test_crc_init); -static void __exit test_crc_exit(void) { } +static void __exit test_crc_exit(void) +{ +} module_exit(test_crc_exit); MODULE_DESCRIPTION("CRC consistency testing driver"); _