From patchwork Sun Nov 13 00:38:45 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Rong Tao X-Patchwork-Id: 19276 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp1492757wru; Sat, 12 Nov 2022 17:10:27 -0800 (PST) X-Google-Smtp-Source: AA0mqf7bCDA+LYPpiRbpiWRpqOjQTrYF1PHgKL9WsrXZLNGVFpxQ8ZQr3kSzGWCFrEJNKfWHt5v0 X-Received: by 2002:a05:6402:3884:b0:458:d9e1:79e1 with SMTP id fd4-20020a056402388400b00458d9e179e1mr6756783edb.289.1668301827799; Sat, 12 Nov 2022 17:10:27 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1668301827; cv=none; d=google.com; s=arc-20160816; b=V8spki0O68o5CTi2vPTCHktcC+F1/+tAnehWktch69aRpaJC3ZwBR1GMgCpbghU/bu bejJBGvQgLuM6fxsm+MZIORD34Yb4UE1nwGL5JyAxUSNpUwsYkn4LooHdQYfMw09qzqN rVH0bWI14D8WDxDQYqywXiwbaxcWSUr5O+GxE9IYH4OUbyctciWHPqrEXGvLjkNTsK3F AxQd3HSp9F4nSqBK3eSE/4EEQROf2qC2/xLHrWnbI6n3CUX2Q6VGnQNkkkmwDyn8rIZU AVHq3kH0B9VhDNUl6juywbczvCNhe8u2Xap5DbIg9wevSrRxlhT3UCtHhZmyhTvEMoHc ZyWg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:date:subject:cc:to:from:message-id :dkim-signature; bh=2cRdI/S/pyLy+8nretmHqms1HRWKzI/Jnv2HJzT7vdw=; b=HOx5xt0HpgcVhXEvPS48O7iSURR4eDdVT1wTwNZ7EQvh256+spGQP7VNL7zdhlruC6 U8/q0Ihd0oesw+28p8DGd7qbtAUC/VAN0qHyk/rNP8925uSwBxf02sXmK/q07nP3Ppgh Pd9nsbGNvSzMzQRvrzj8arB+zTKXWAepPjAFY89jr9t9f2WPgCVrXjt2St845NcPS7Nq 855tRFXwsYm56YYyPwUpSTRsmraqGmVaZtHd/gGF6+toXayyQpPlspzQYKOkKcNko9YZ zVt7UdUDMZSH5pV+4YsZiL2Mq9AnSi6Do182w7ou3KuxTHKn7jfRMdDm5TAtQkgjhpD+ i0mw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@foxmail.com header.s=s201512 header.b=LLXxo9Np; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=foxmail.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id z5-20020a056402274500b0046314dd20a0si7245252edd.3.2022.11.12.17.10.04; Sat, 12 Nov 2022 17:10:27 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@foxmail.com header.s=s201512 header.b=LLXxo9Np; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=foxmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231534AbiKMAi4 (ORCPT + 99 others); Sat, 12 Nov 2022 19:38:56 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60350 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230170AbiKMAiy (ORCPT ); Sat, 12 Nov 2022 19:38:54 -0500 Received: from out203-205-221-235.mail.qq.com (out203-205-221-235.mail.qq.com [203.205.221.235]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 77E246143; Sat, 12 Nov 2022 16:38:52 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=foxmail.com; s=s201512; t=1668299930; bh=2cRdI/S/pyLy+8nretmHqms1HRWKzI/Jnv2HJzT7vdw=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=LLXxo9Np4ajwhcjzpV6dffIOOKiIiUEkW1PPrC6/yK4O4mhZK8M5Zy/Uw9y3avYcl k/bbGWm+WwWJ3femlAwzqFJk6iSIfGYrQC3/6eifO7K2ImV2WHNg4BH46G+R3HswQ4 3J/MDs0Ufmw0wmfq9txGdor3xU0czjVYzB/AoMnY= Received: from localhost.localdomain ([111.199.191.46]) by newxmesmtplogicsvrsza2-0.qq.com (NewEsmtp) with SMTP id 9AF8F8B9; Sun, 13 Nov 2022 08:38:47 +0800 X-QQ-mid: xmsmtpt1668299927tfp8q3hqv Message-ID: X-QQ-XMAILINFO: NZzGjqyvvdMfgsydAIcT9xoW54Ws8FXNoBHd1bfWi2DLG/M637nms1IARbv4YI B1/ovn5BvkebVUjYB5DAHVRo0RnG/lz7oUrjtyASvwDC9Y8vHeQ3Mk+q6wlnDnix7VXaGO/OX+K9 CQNPuqvBtXCJ2Z5XClJNL0GOGSv6dBX/JoWeDeprg2+anp3pVKmBABw4bziSLiZSHzClLL5ZI68Q eCW0a0qRb0XJK6jfTTov9A/kv2RdeFOA1gbA+JKwXU7PqaVE/v6CLHVLod11qbTCGwbZZw2uenkB eLMhyXtiYvEurhulKr7+2pljEiriqUiAu9wWfLWfNOwMaKu1fR/PMikd0m5UuVMAqkE8fx0qBsre f9I8Y+2PKHVfHRMkDE7THf8GdIe8Xl8bce21DjH3X9RnF7vbfbPkg+2JhMnxcwfroI+C6c3UeZjU 6nWoHXfkJo8LDIc3x61hFOZhjztXxppIgivcUsg+YMKxNZ/xiM09R9dVvXtEzu7crfhCLpoF4QGp 0fVVIJvGnbQesI7IvoR60iTYwSMelarb1v8DxTRNczblCcHuty/cAVymuUSxe6+tay3b5qkYfK/M gGd/ErfCWXWPCtEqDKXEv22G7xVhL72ZPrDLrPrMLjpLXZX/OjNlbDng4GeYta09VOSMRBUIX1s6 foCzwA0RURtNDOP+cZwbksYKxTPU3BYoTWkdwlfALwvXktppHHaYUjRgDqfIw3FwV2y0hJtEZjCz IpNyJAftvPUugM9t5/kzjqWwlEvZIw5u1wgNR9RZ6c60oL24ds4/T7haKaJ2Hbrl/gtdWFAPFic/ ej7xYldv4ShJ/+3jAwknSLAqhFEFnlhx+I48L0sNyIv3C8Asbf4tCJisb/h+ViAS8Qw47gy8ucmD +IBlErS2CuXffX+Z/ZGnFxgodtkGYkCLQB8AA5qjC8UPo1Uvlc0WdpkOcw/krSdTE/2Amm63b8OT 8Fc6FWP3X+rgDUNSyvlMb15aX5EnsPYn4KF8uwyFATDkOxwg0jYD/Il/YPaHbD From: Rong Tao To: sj@kernel.org Cc: damon@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 v3] selftests/damon: Fix unnecessary compilation warnings Date: Sun, 13 Nov 2022 08:38:45 +0800 X-OQ-MSGID: <20221113003845.8709-1-rtoax@foxmail.com> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20221112183050.85200-1-sj@kernel.org> References: <20221112183050.85200-1-sj@kernel.org> MIME-Version: 1.0 X-Spam-Status: No, score=0.8 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM, HELO_DYNAMIC_IPADDR,RCVD_IN_DNSWL_NONE,RDNS_DYNAMIC,SPF_HELO_NONE, SPF_PASS autolearn=no autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1749116724319628472?= X-GMAIL-MSGID: =?utf-8?q?1749341257665181074?= From: Rong Tao When testing overflow and overread, there is no need to keep unnecessary compilation warnings, we should simply ignore them. The motivation for this patch is to eliminate the compilation warning, maybe one day we will compile the kernel with "-Werror -Wall", at which point this compilation warning will turn into a compilation error, we should fix this error in advance. How to reproduce the problem (with gcc-11.3.1): $ 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=] "-Wno-stringop-overread" is supported at least in gcc-11.1.0. Link: https://gcc.gnu.org/git/?p=gcc.git;a=commit;h=d14c547abd484d3540b692bb8048c4a6efe92c8b Signed-off-by: Rong Tao Reviewed-by: SeongJae Park --- tools/testing/selftests/damon/huge_count_read_write.c | 9 +++++++++ 1 file changed, 9 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..a6fe0689f88d 100644 --- a/tools/testing/selftests/damon/huge_count_read_write.c +++ b/tools/testing/selftests/damon/huge_count_read_write.c @@ -8,6 +8,13 @@ #include #include +#pragma GCC diagnostic push +#if __GNUC__ >= 11 && __GNUC_MINOR__ >= 1 +/* Ignore read(2) overflow and write(2) overread compile warnings */ +#pragma GCC diagnostic ignored "-Wstringop-overread" +#pragma GCC diagnostic ignored "-Wstringop-overflow" +#endif + void write_read_with_huge_count(char *file) { int filedesc = open(file, O_RDWR); @@ -27,6 +34,8 @@ void write_read_with_huge_count(char *file) close(filedesc); } +#pragma GCC diagnostic pop + int main(int argc, char *argv[]) { if (argc != 2) {