Received: by 2002:a05:6358:c692:b0:131:369:b2a3 with SMTP id fe18csp5294040rwb; Mon, 31 Jul 2023 23:23:55 -0700 (PDT) X-Google-Smtp-Source: APBJJlHFA6sFSr1o1GAUamx2eryx7iQg8/pnrO3hrahBX7V82FX/Lskt4GhjErjstKS3j0PloD5b X-Received: by 2002:aa7:d9d7:0:b0:522:3ebc:84b9 with SMTP id v23-20020aa7d9d7000000b005223ebc84b9mr1747861eds.24.1690871035417; Mon, 31 Jul 2023 23:23:55 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1690871035; cv=none; d=google.com; s=arc-20160816; b=Zzs/9wiFdoje3Kh+HtMMrNlMsAeDuFPsdjB7B+76YwHkj9QH5nmK1sOf0ZqbhOPPDp EXJxFEo7O4sEHRkpBWFm0934M64kqsGCLJTld6p7VMHUPzwC5Y4yCoT+bMi9VvPHuBHD Rkj7NfD4Pce0UDdUpikEXKKtyOH3g5m+l08SzrF/RHBZmugrQ3o7S9Smc6y2hA9B42fU hedFN6/IJchG2OI8soah0fTMKlRb7ZPUewXpssaJ8fErc6kHRATxi2CU1MfhFcQgl5RE rN/+EZHR7Vn8PKtliuNilxWN5XXsw+BfIT/A1ZUVlEIRlYwkU+CfyvrV+kn/jH1hw+jH bxnQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-transfer-encoding :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:dkim-signature; bh=+jQfcmh4PlnTMaqjx/xExMCYgh1HlA+8rokuSXQEmB4=; fh=xRdaOVXaRGrwW+9cTzkYYWmW/o9rqCRdnarYV03e28c=; b=DUXi4YLNsx0a/WTa9Dbv/QUP1iV49k9eoGWLaJhWsfS0BWvaC29FChzMx5sY1RhxUF fh577YHzg2FXEOb6IZORXDwvphwVwtXDxHU0zd9Ud4PSXz2iSCDpSMYK4XA3ozDLV9o/ dfLUqSLxhaNvMv0Mq22S7hyQN5uW49fLIFUprP4IC1eRKm2UoJZRkazS6NvmW/Sxft3R T9eMpmZhteA7w+jdcQkQo//WixTeEdfzBjB/qCQ3o3BaihvnQkd3ukGcG+ojp1SBeaWP ytzYnYUFmlRkmzFy1XcxrpQ0ENDKmFYK8aTP8BP1kRYRJJpmKLRsRU4JIsblIEK8PuNG cYtA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@weissschuh.net header.s=mail header.b=fdZ7kCZK; 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 Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id k11-20020aa7d8cb000000b00521d18821aasi7578192eds.109.2023.07.31.23.23.31; Mon, 31 Jul 2023 23:23:55 -0700 (PDT) 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=@weissschuh.net header.s=mail header.b=fdZ7kCZK; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231154AbjHAF5o (ORCPT + 99 others); Tue, 1 Aug 2023 01:57:44 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56486 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229543AbjHAF5n (ORCPT ); Tue, 1 Aug 2023 01:57:43 -0400 Received: from todd.t-8ch.de (todd.t-8ch.de [159.69.126.157]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id ECA22E7D; Mon, 31 Jul 2023 22:57:41 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=weissschuh.net; s=mail; t=1690869460; bh=Sxb7+n6qZ5PmXQo2k8+b+wVoId3QKcNBSJ9E1tXXK2s=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=fdZ7kCZKtxF1tZF8GLScdjKNlezKsMqyMZsYb7pLy9VMxko0bOOCEgeXm0Zx25nO0 /y/f/zaj23bQEh7tEIlItAm1HtMRr5LQGtpWZaOFW7EyPi7i88+CXxkJnFE2Rjlj6f arfTjkTtWsZJUQ7DUfGvXZ83k5dmZqri0bsvyQ7M= Date: Tue, 1 Aug 2023 07:57:39 +0200 From: Thomas =?utf-8?Q?Wei=C3=9Fschuh?= To: Zhangjin Wu Cc: linux-kernel@vger.kernel.org, linux-kselftest@vger.kernel.org, shuah@kernel.org, tanyuan@tinylab.org, w@1wt.eu Subject: Re: [PATCH v2 08/10] selftests/nolibc: avoid sign-compare warnings Message-ID: <54502a41-5c35-4c79-812f-263d5e24f056@t-8ch.de> References: <20230801-nolibc-warnings-v2-8-1ba5ca57bd9b@weissschuh.net> <20230801054819.37659-1-falcon@tinylab.org> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <20230801054819.37659-1-falcon@tinylab.org> X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,SPF_HELO_NONE,SPF_PASS, T_SCC_BODY_TEXT_LINE,URIBL_BLOCKED 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 Zhangjin! On 2023-08-01 13:48:19+0800, Zhangjin Wu wrote: > > These warnings will be enabled later so avoid triggering them. > > > > Signed-off-by: Thomas Weißschuh > > --- > > tools/testing/selftests/nolibc/nolibc-test.c | 4 ++-- > > 1 file changed, 2 insertions(+), 2 deletions(-) > > > > diff --git a/tools/testing/selftests/nolibc/nolibc-test.c b/tools/testing/selftests/nolibc/nolibc-test.c > > index cb17cccd0bc7..82714051c72f 100644 > > --- a/tools/testing/selftests/nolibc/nolibc-test.c > > +++ b/tools/testing/selftests/nolibc/nolibc-test.c > > @@ -749,7 +749,7 @@ static int test_mmap_munmap(void) > > }; > > > > page_size = getpagesize(); > > - if (page_size < 0) > > + if (page_size == 0) > > return -1; > > > > It was my mistake before, but do we need to align with the one used in > test_getpagesize(): > > static int test_getpagesize(void) > { > long x = getpagesize(); > int c; > > if (x < 0) > return x; > > Use 'long' instead of 'size_t' to declare page_size? Good point. Given that getpagesize() is documented as returning "int" I guess we should actually change the implementation in nolibc. > Thanks, > Zhangjin > > > /* find a right file to mmap, existed and accessible */ > > @@ -998,7 +998,7 @@ static int run_stdlib(int min, int max) > > #define EXPECT_VFPRINTF(c, expected, fmt, ...) \ > > ret += expect_vfprintf(llen, c, expected, fmt, ##__VA_ARGS__) > > > > -static int expect_vfprintf(int llen, size_t c, const char *expected, const char *fmt, ...) > > +static int expect_vfprintf(int llen, int c, const char *expected, const char *fmt, ...) > > { > > int ret, fd, w, r; > > char buf[100]; > > > > -- > > 2.41.0