Received: by 2002:a05:6358:700f:b0:131:369:b2a3 with SMTP id 15csp1890917rwo; Thu, 3 Aug 2023 01:04:16 -0700 (PDT) X-Google-Smtp-Source: APBJJlEJ2F0+gHnZk39bQiY4XaQ5xRkJil3+9aGhZkswi2lHE7StKABAutPWXnZtFWIwHujTU5nv X-Received: by 2002:a2e:9097:0:b0:2b9:3883:a765 with SMTP id l23-20020a2e9097000000b002b93883a765mr6853876ljg.31.1691049855831; Thu, 03 Aug 2023 01:04:15 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1691049855; cv=none; d=google.com; s=arc-20160816; b=tW1alfXuiyR5s+dZB9AJ4XYeFk+/s13diOOYTRbBXYIHOy63k9Xb0YZ80817tQoPi8 a91hFGGG2nu8cnDon7qyRws9AhzfV7X+2IWsmZgvbycmhhCtVPL9kQopXeJDchlVfY2D F9gl1E8NywJk8ji6YEO7XYNC4pUqqH/j2XSqgiDncOWp/89PtqoA/JPyi+kRYsd5n/Rb 2+ks4XUpwRmuHbLIpHzlvMydJCyO927cy2uHSxWHzuCu1bNDJDmmSX+85fk2FQaHkKvk LcqruBSPsKUuqJ2wbcVHF6IeSpNnDp0QZnJxOJFpYC65JM1t8PikNqqw1PaOE5/z4B/x puAg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:in-reply-to:references:message-id :content-transfer-encoding:mime-version:subject:date:from :dkim-signature; bh=pLlh7gECDQ5k4yrL8Mxfi52YAiCVjhpanMiMfdHvAIU=; fh=UZfhiU2pgwvZdBOe9fFEhnfTQX0/6KsvXKQubWsfhik=; b=Nzoxgw7x1MwVMyBHPu3VpaecDHinu8v7RrHBP9s3iWr+7fSDOvImQYkP8xTgFRsKuo 0S/9GU81cY+8kGOpqxdoHzGq3N3jwDq45TN+F9s9Ds1P4qihpQ4rINX/WZJIy1lWHenM Rt5Li3yugRyPNpLXl4kZFICPBoWoGoM54Pr9nhGV+8OJW7XiajXjTwEPzCsfCGPUEB/v hipPRmsz1u1EUY+NCiyRw3PZ5uG/Al27PYn93UPjVRIYxTn1s9n4Kl2UhUS8QGSafYkY cmMzZzOc9oNqwySIAmS51vEPn1B+lkbz+1G0Y2vRX5CUDO6/yVFgyu4CC4YZCeBp/APK hdCw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@weissschuh.net header.s=mail header.b=mFfiRKly; 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 s23-20020a1709066c9700b0099bcb8f4f00si342024ejr.409.2023.08.03.01.03.51; Thu, 03 Aug 2023 01:04:15 -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=mFfiRKly; 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 S232378AbjHCH3h (ORCPT + 99 others); Thu, 3 Aug 2023 03:29:37 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43124 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232330AbjHCH2z (ORCPT ); Thu, 3 Aug 2023 03:28:55 -0400 Received: from todd.t-8ch.de (todd.t-8ch.de [IPv6:2a01:4f8:c010:41de::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 9606A187; Thu, 3 Aug 2023 00:28:54 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=weissschuh.net; s=mail; t=1691047729; bh=FOosJH/CmUX2d0gi9dET+M4ykNx0gigEkRwzseP0iBQ=; h=From:Date:Subject:References:In-Reply-To:To:Cc:From; b=mFfiRKlyRQ1RA8jAfiLWQNaBJouglzSvWbjxpUEHbrdgJGElid8O7uGRRKCNDkata Lm6yvEGonFX+awVTZ0VkBWNQEqPBau8BSTZTgGH5+LtlRHZ0Fb08Rru/GPjSE7Enoz vZELYSf3f2fXiqXFU385Ds9sucRx16qQJgQR4QpQ= From: =?utf-8?q?Thomas_Wei=C3=9Fschuh?= Date: Thu, 03 Aug 2023 09:28:55 +0200 Subject: [PATCH v3 11/14] selftests/nolibc: use correct return type for read() and write() MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 8bit Message-Id: <20230803-nolibc-warnings-v3-11-bcc1a096ae02@weissschuh.net> References: <20230803-nolibc-warnings-v3-0-bcc1a096ae02@weissschuh.net> In-Reply-To: <20230803-nolibc-warnings-v3-0-bcc1a096ae02@weissschuh.net> To: Willy Tarreau , Shuah Khan Cc: linux-kselftest@vger.kernel.org, linux-kernel@vger.kernel.org, Yuan Tan , Zhangjin Wu , =?utf-8?q?Thomas_Wei=C3=9Fschuh?= X-Mailer: b4 0.12.3 X-Developer-Signature: v=1; a=ed25519-sha256; t=1691047727; l=1419; i=linux@weissschuh.net; s=20221212; h=from:subject:message-id; bh=FOosJH/CmUX2d0gi9dET+M4ykNx0gigEkRwzseP0iBQ=; b=4jNwczucEessfNJbJG8Wi2UcI2FKtV4G8+Nx0CetT9ICUSxSaPgKRg7DdIBB2TwdxoPicmrBM D9BTJZbvnjMC78Q4K/x2E3FsSdqFaUiA6M/Oht8hc9RR+eqyUkW82f4 X-Developer-Key: i=linux@weissschuh.net; a=ed25519; pk=KcycQgFPX2wGR5azS7RhpBqedglOZVgRPfdFSPB1LNw= X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_BLOCKED, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE 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 Avoid truncating values before comparing them. As printf in nolibc doesn't support ssize_t add casts to int for printing. Signed-off-by: Thomas Weißschuh --- tools/testing/selftests/nolibc/nolibc-test.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/tools/testing/selftests/nolibc/nolibc-test.c b/tools/testing/selftests/nolibc/nolibc-test.c index 0ab241d61508..63f09800057d 100644 --- a/tools/testing/selftests/nolibc/nolibc-test.c +++ b/tools/testing/selftests/nolibc/nolibc-test.c @@ -1023,7 +1023,8 @@ int run_stdlib(int min, int max) static int expect_vfprintf(int llen, int c, const char *expected, const char *fmt, ...) { - int ret, fd, w, r; + int ret, fd; + ssize_t w, r; char buf[100]; FILE *memfile; va_list args; @@ -1045,7 +1046,7 @@ static int expect_vfprintf(int llen, int c, const char *expected, const char *fm va_end(args); if (w != c) { - llen += printf(" written(%d) != %d", w, c); + llen += printf(" written(%d) != %d", (int)w, c); result(llen, FAIL); return 1; } @@ -1059,7 +1060,7 @@ static int expect_vfprintf(int llen, int c, const char *expected, const char *fm fclose(memfile); if (r != w) { - llen += printf(" written(%d) != read(%d)", w, r); + llen += printf(" written(%d) != read(%d)", (int)w, (int)r); result(llen, FAIL); return 1; } -- 2.41.0