From patchwork Fri Nov 11 02:37:20 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Rong Tao X-Patchwork-Id: 13039518 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 29AAFC4332F for ; Fri, 11 Nov 2022 02:49:04 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233147AbiKKCtD (ORCPT ); Thu, 10 Nov 2022 21:49:03 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38302 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232711AbiKKCsk (ORCPT ); Thu, 10 Nov 2022 21:48:40 -0500 Received: from out203-205-221-239.mail.qq.com (out203-205-221-239.mail.qq.com [203.205.221.239]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 0E701E42; Thu, 10 Nov 2022 18:43:11 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=foxmail.com; s=s201512; t=1668134590; bh=BL3Df7T2fda2YYRMS2L+HCFmYgkJzAzwFsLU2JM9Hkw=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=op116er2zCaFNKU2gJBwvP6wi2j3j4m/14zzKInq1OhzkFqgUn7nRYvVuKHEUIHpe 080wVBrV4wf4Y3iWecSpurBxHBJ0iNEUUuSpN5V7coMkwE/lHka7EiHODm3KtCPBdc rBg70rIolxtvtYf5A2YSYlmjVxEBjBupqsOR+x6w= Received: from localhost.localdomain ([111.199.191.46]) by newxmesmtplogicsvrsza2-0.qq.com (NewEsmtp) with SMTP id 95619E78; Fri, 11 Nov 2022 10:37:22 +0800 X-QQ-mid: xmsmtpt1668134242to097gvqf Message-ID: X-QQ-XMAILINFO: NQR8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on@lists.linux.dev, linux-kernel@vger.kernel.org, linux-kselftest@vger.kernel.org, linux-mm@kvack.org, rongtao@cestc.cn, rtoax@foxmail.com, shuah@kernel.org, yuanchu@google.com Subject: [PATCH] selftests/damon: Fix unnecessary compilation warnings Date: Fri, 11 Nov 2022 10:37:20 +0800 X-OQ-MSGID: <20221111023720.15408-1-rtoax@foxmail.com> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20221110200939.101886-1-sj@kernel.org> References: <20221110200939.101886-1-sj@kernel.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-kselftest@vger.kernel.org From: Rong Tao When testing overflow and overread, there is no need to keep unnecessary compilation warnings, we should simply ignore them. How to reproduce the problem: $ make -C tools/testing/selftests/ ... warning: ‘write’ reading 4294967295 bytes from a region of size 1 [-Wstringop-overread] warning: ‘read’ writing 4294967295 bytes into a region of size 25 overflows the destination [-Wstringop-overflow=] Signed-off-by: Rong Tao --- tools/testing/selftests/damon/huge_count_read_write.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/tools/testing/selftests/damon/huge_count_read_write.c b/tools/testing/selftests/damon/huge_count_read_write.c index ad7a6b4cf338..8fbe276870e7 100644 --- a/tools/testing/selftests/damon/huge_count_read_write.c +++ b/tools/testing/selftests/damon/huge_count_read_write.c @@ -8,6 +8,11 @@ #include #include +#pragma GCC diagnostic push +/* Ignore read(2) overflow and write(2) overread compile warnings */ +#pragma GCC diagnostic ignored "-Wstringop-overread" +#pragma GCC diagnostic ignored "-Wstringop-overflow" + void write_read_with_huge_count(char *file) { int filedesc = open(file, O_RDWR); @@ -27,6 +32,8 @@ void write_read_with_huge_count(char *file) close(filedesc); } +#pragma GCC diagnostic pop + int main(int argc, char *argv[]) { if (argc != 2) {