From patchwork Mon Oct 7 15:10:45 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Masami Hiramatsu (Google)" X-Patchwork-Id: 11177765 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id D69F4112B for ; Mon, 7 Oct 2019 15:10:51 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id B5BD72173B for ; Mon, 7 Oct 2019 15:10:51 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1570461051; bh=FIUvS515BRyZWWsbgjwGzMabdeFOcPuhq53HL6bR4Bk=; h=From:To:Cc:Subject:Date:In-Reply-To:References:List-ID:From; b=E8YbiVHkQDRMdyZnWDEpQ1sWiMZZw8BENPC3w6w5oHnZxD7cf/U62bGswR2ahtfSY yvhrR8eHN84CH2Hd2IxiqlIoFCGxnFUVEO1R+/wEgZ9qiA0O3DCJwBmF9z9YLxY029 junibgpiwivLLoHs+VK/MLG1dkK95NMLzg/bRPIA= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728703AbfJGPKv (ORCPT ); Mon, 7 Oct 2019 11:10:51 -0400 Received: from mail.kernel.org ([198.145.29.99]:36132 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726334AbfJGPKv (ORCPT ); Mon, 7 Oct 2019 11:10:51 -0400 Received: from localhost.localdomain (NE2965lan1.rev.em-net.ne.jp [210.141.244.193]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id B72ED2070B; Mon, 7 Oct 2019 15:10:48 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1570461050; bh=FIUvS515BRyZWWsbgjwGzMabdeFOcPuhq53HL6bR4Bk=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=FRmNryRQEJ7cqOuMLYqnj3fakuyXTQjkXrRFklSczVw8sNMLx6mTpun3s+zPhdmZG y4wmcn+OMIqE5RHl6X/ENa+uU/zcy34t9AYLy8QNlRSQLCaF3bHSGax7N1TX8gJUoj CZI7bcVSjH74fw3VabpUlilxjtXfasRrH+na6gdc= From: Masami Hiramatsu To: Shuah Khan Cc: linux-kselftest@vger.kernel.org, linux-kernel@vger.kernel.org, jaswinder.singh@linaro.org, Eric Dumazet , "David S . Miller" Subject: [BUGFIX PATCH 3/5] selftests: net: Use size_t and ssize_t for counting file size Date: Tue, 8 Oct 2019 00:10:45 +0900 Message-Id: <157046104535.20724.6659308145965966926.stgit@devnote2> X-Mailer: git-send-email 2.20.1 In-Reply-To: <157046101671.20724.9561877942986463668.stgit@devnote2> References: <157046101671.20724.9561877942986463668.stgit@devnote2> User-Agent: StGit/0.17.1-dirty MIME-Version: 1.0 Sender: linux-kselftest-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kselftest@vger.kernel.org Use size_t and ssize_t correctly for counting send file size instead of unsigned long and long, because long is 32bit on 32bit arch, which is not enough for counting long file size (>4GB). Signed-off-by: Masami Hiramatsu Cc: Eric Dumazet Cc: David S. Miller --- tools/testing/selftests/net/tcp_mmap.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/tools/testing/selftests/net/tcp_mmap.c b/tools/testing/selftests/net/tcp_mmap.c index 31ced79f4f25..33035d1b3f6d 100644 --- a/tools/testing/selftests/net/tcp_mmap.c +++ b/tools/testing/selftests/net/tcp_mmap.c @@ -71,7 +71,7 @@ #define MSG_ZEROCOPY 0x4000000 #endif -#define FILE_SZ (1UL << 35) +#define FILE_SZ (1ULL << 35) static int cfg_family = AF_INET6; static socklen_t cfg_alen = sizeof(struct sockaddr_in6); static int cfg_port = 8787; @@ -155,7 +155,7 @@ void *child_thread(void *arg) socklen_t zc_len = sizeof(zc); int res; - zc.address = (__u64)addr; + zc.address = (__u64)((unsigned long)addr); zc.length = chunk_size; zc.recv_skip_hint = 0; res = getsockopt(fd, IPPROTO_TCP, TCP_ZEROCOPY_RECEIVE, @@ -302,7 +302,7 @@ int main(int argc, char *argv[]) { struct sockaddr_storage listenaddr, addr; unsigned int max_pacing_rate = 0; - unsigned long total = 0; + size_t total = 0; char *host = NULL; int fd, c, on = 1; char *buffer; @@ -417,7 +417,7 @@ int main(int argc, char *argv[]) zflg = 0; } while (total < FILE_SZ) { - long wr = FILE_SZ - total; + ssize_t wr = FILE_SZ - total; if (wr > chunk_size) wr = chunk_size;