Received: by 2002:a05:6358:d09b:b0:dc:cd0c:909e with SMTP id jc27csp2526775rwb; Fri, 11 Nov 2022 10:30:58 -0800 (PST) X-Google-Smtp-Source: AA0mqf7lPrPWN9pukQSqHc8UVc/6IAEJX3jLbuTBHTa6u84XVeMmiqwM5z0O7hxUWCp4mkY+K/Va X-Received: by 2002:a05:6402:4018:b0:461:dd11:c1bd with SMTP id d24-20020a056402401800b00461dd11c1bdmr2498485eda.406.1668191458662; Fri, 11 Nov 2022 10:30:58 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1668191458; cv=none; d=google.com; s=arc-20160816; b=lQsAHJAEPJbtDyzNyL0TWPrrOoqpuLFi4ezumbFoWG0sBLipZTNY9+oiebQ15pOhF6 mPf/PIPgB/QziM5vYjJla9ovV3dPTiiEbi3cCMfSogKf3qmznvTcpXBsJXrB5mK9+cZt hBQa1gP6oWEpcmpO5ejlZCgxFxqOkR17284QQDePyGYJ0ng4beMkrpG+btzDcQ8jLjsp 46+nnDFp42k356CEYdUgnRKrxDcnsW+PRdz+4I+KVBFcptxZJ6lecny4VvOpsZPWrRd3 nDT596jKId3YLkPHoj879YPmdaTXpML4GhcYU8r5+rFoYmBBDpXsjGj4qBOwaFIAxIj6 rceA== 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:message-id:date:subject:cc:to:from :dkim-signature; bh=PAyR1qzNYx4f9lPdrSwhpkRVo4XY4VN7xwr7R+Lwi8A=; b=fnu8Bzi0SrTyxVIpYNw6xCPU9Z8hmXaICh5jEkdShfdSI3AKyCOBd1lCi0xO8RUrba NszUsC6fahLug6a0b6dpCaVRSjvfWK0XRsEJrD5EPiTVle5mOSB5xiSz4Tr5LlJhJ98X PmVYO0bd9XI2Ih8Ms5W85dsvd3ZCAyoILvizPUuFD1Y6zi/vEt745bvF8cV8EHtRxYMn tL05JHWpIzFbaYIwVp6SSVt/HKqvb9tLtjna46TJNMj4QA5rDWMc3I5Gv3cjMHqqrWcz gWAb2SxcWWyvbVTvbD9UaUOskzTXXYaLjLlGC+kkNubr6cYs1lHt7miMhxly2261qCf/ OkYg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b="t1H/cEE4"; 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=kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id ho16-20020a1709070e9000b0073ffabc3352si2804573ejc.836.2022.11.11.10.30.36; Fri, 11 Nov 2022 10:30:58 -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=@kernel.org header.s=k20201202 header.b="t1H/cEE4"; 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=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233511AbiKKRjD (ORCPT + 91 others); Fri, 11 Nov 2022 12:39:03 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39504 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233851AbiKKRjB (ORCPT ); Fri, 11 Nov 2022 12:39:01 -0500 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 046AD61B84; Fri, 11 Nov 2022 09:38:59 -0800 (PST) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 9527E6206D; Fri, 11 Nov 2022 17:38:58 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 53C25C433C1; Fri, 11 Nov 2022 17:38:57 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1668188338; bh=pVSG4o9o7ELZjK0i4XqofCGBuPWYjWKlXf96GCOImGc=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=t1H/cEE4N44Xw3DctnOnlHXKoi27WfQjOTKxdjmtmS5ep1HuMVWnGoaD7M40rz/PZ HDCenm1V5W+mtGUbmNqu3oSf+fUpPjUrAMNIT18SVLnuV1WXuG8A4817b55IJ4dI8Z ion0aTgFjjYPAU0BvtvFpFaHuJ4VK5nzQ04BqU9CtdF4wm3hcmVpemXs+mVmOHXq29 ZFOb0H57A+Z3wtKiM5+JhmCUWey7dRhfe+wQwsUdPFWA8dexZYM9Jf3lDRZvlulz2r bv0BFpbPPziC3o8ry8PqGp49AaI9HO3JHdXQAxFpyfdWRMvowhzIFjo4FCsub3v3PZ TbEGlfhvOjuqQ== From: SeongJae Park To: Rong Tao Cc: sj@kernel.org, damon@lists.linux.dev, linux-kernel@vger.kernel.org, linux-kselftest@vger.kernel.org, linux-mm@kvack.org, rongtao@cestc.cn, shuah@kernel.org, yuanchu@google.com Subject: Re: [PATCH] selftests/damon: Fix unnecessary compilation warnings Date: Fri, 11 Nov 2022 17:38:55 +0000 Message-Id: <20221111173855.108360-1-sj@kernel.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: References: MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-7.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham 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 Hi Rong, It would be better if you could notice the version of this patch using 'PATCH v2' like subject prefix from next time. On Fri, 11 Nov 2022 10:37:20 +0800 Rong Tao wrote: > 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=] Thank you for indenting as I suggested! BTW, I'm ok to violate the line length limit for quoting commands outputs. > > 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" This still trigger below error on my old gcc. gcc -Wno-stringop-overread -Wno-stringop-overflow huge_count_read_write.c -o /home/sjpark/linux/tools/testing/selftests/damon/huge_count_read_write huge_count_read_write.c:13:32: warning: unknown option after ‘#pragma GCC diagnostic’ kind [-Wpragmas] 13 | #pragma GCC diagnostic ignored "-Wstringop-overread" | ^~~~~~~~~~~~~~~~~~~~~ cc1: warning: unrecognized command line option ‘-Wno-stringop-overread’ I don't think that's a blocker of this patch, but hope to hear your opinion. Thanks, SJ > +#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) { > -- > 2.31.1 >