Received: by 2002:ac0:a5a7:0:0:0:0:0 with SMTP id m36-v6csp2091432imm; Thu, 2 Aug 2018 06:10:19 -0700 (PDT) X-Google-Smtp-Source: AAOMgpc6YThJyUaDn2poegg+ggc9n+ijt+KDMKAq55b/lMBeLaQS8xFClONSSHQk9s3et5DOhfon X-Received: by 2002:a63:fe4d:: with SMTP id x13-v6mr2750549pgj.152.1533215419496; Thu, 02 Aug 2018 06:10:19 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1533215419; cv=none; d=google.com; s=arc-20160816; b=r9WW9tZP4aBGy16nb2mDwJnNF4wvyX1Xvw+9lFPgGa7zjBNWz7RpvowoUCnqCEjMXf MSAI1pBVYWwkqfso34fUXt8xHeycB3EA6Md6fsEzpnC//4uPsEeCxAe5tEm2bE8HI2FJ FQepft/USGm6J2xGmV1cJj/rhSvNjWrn+76JooReR1JYiaC6ohrEMDeEmKBqk9MYpq5l dZscW2fIM0cLApu68geeb2nDDzG01P9eJLzGvOrbqHz4xceRLUWAOwnADtvF6vX+nYKf arHsAPPb2vywxT9uVn6W6EIX/hzW+6qeDBdA/ZO5yHis0LArlg1nkeNJMQCUwQML7rqE 4mVA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding :content-language:in-reply-to:mime-version:user-agent:date :message-id:from:references:cc:to:subject:dkim-signature :arc-authentication-results; bh=VuW86wa96t3ez7wcmNMogdD0V44YmRXIyDyX3komb7E=; b=j6C6qTnm2OQfHKgCr4wDps57q8BGnvsZWNdeqEGwqwmKFExQzYHzThNIe8tKXzQWS/ +ISmvB27heQgqn+AdCpmYdKqBPYhzAqKo2ksyOnAE0aCaFio7iHpXjxguKu0wEBggkbL dR9B4YirqAmZw7Dob+w28ebgsBJzTxb2NFXE8MltEV5fkeoO6s2+658hqMi9mu3XDVDY jDmUZYqZqCImA4mBjHlvyqYusqeDIHJEoW0DNe34WEuV/WcmSpOGfVPUkzDeyGjTwFbS MgXVvfCkWzgv3hyi+eYi3kGQnGyg1DmBEjzRH5169CfQwak6witYAos97PIrHJkH/NVz Nm7Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b="vbE/zplH"; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id p3-v6si949311pld.329.2018.08.02.06.10.05; Thu, 02 Aug 2018 06:10:19 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b="vbE/zplH"; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2387578AbeHBO7p (ORCPT + 99 others); Thu, 2 Aug 2018 10:59:45 -0400 Received: from mail-pg1-f196.google.com ([209.85.215.196]:43190 "EHLO mail-pg1-f196.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2387421AbeHBO7p (ORCPT ); Thu, 2 Aug 2018 10:59:45 -0400 Received: by mail-pg1-f196.google.com with SMTP id d17-v6so1157798pgv.10; Thu, 02 Aug 2018 06:08:36 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=subject:to:cc:references:from:message-id:date:user-agent :mime-version:in-reply-to:content-language:content-transfer-encoding; bh=VuW86wa96t3ez7wcmNMogdD0V44YmRXIyDyX3komb7E=; b=vbE/zplHti1cpSgLhG5Il5RhM4rKi/1gW+0HPsIIikvx/7+NPRu0sP3WXoKWRMB/bC eDNOlpwy1ICtgVyfFpvE5K7YzkOHwbe2oR//NBmHbKO2Bx1WOfBvOnOBRyKsfBWVkm32 HbLOx3ZVVd0TDzd8gTSq0+20bUQsYA3lC4GObTFXysVPKNVlDawnn/go3HW2Hg5AvVGE YOrPs5E5Eyj7ldCMtAyLxZ8xyUESkFJGK1s1GKN5uYrE03QblQrpd7YOe2JDrZfopi/u VFqTTVJIci/BZN38IcPEtEWCCy9G/zkoo/9z97kFCFfsmTUDGvFzID67yGCapPBNUgOK 64mQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:subject:to:cc:references:from:message-id:date :user-agent:mime-version:in-reply-to:content-language :content-transfer-encoding; bh=VuW86wa96t3ez7wcmNMogdD0V44YmRXIyDyX3komb7E=; b=SHKHpgBysyWR4XOLFfDneUzqXySMUB2boOKr/ZDQ3bj8hzqOjgxE1uf9OO2TfylNMn JFhjcqLdZCSFZVzzd1RoqvsOp7SglLCm6Me21uNxLZIEjXOKSFAfl6YOii8hKiUISrc3 pVasLefhkjN2Bgo8tvRTxXa4ORhkiMyD7EeV3mr6jn2ktJN29ySGjToXyzreU0uzfZyh eo58KfoY/Quz7AoMwM0djImTVCADvIMBhzo5ulPLC/seuHOe9vGxNJNueHFCrkUqPB7C YVLIbDe95hcBAy0z2uiKmpeBwqu1a4c78VHvmL0llczAYmE80ZdgaNskTWa7Eg+ztBJc vktQ== X-Gm-Message-State: AOUpUlEHEk8wO5rCdToaP9d9avWyhub9k4ME3tedfhT7amKY/X6TjGv/ kVaSkL+KNkvy/d5753Wn+uA= X-Received: by 2002:a63:5025:: with SMTP id e37-v6mr2754096pgb.341.1533215316552; Thu, 02 Aug 2018 06:08:36 -0700 (PDT) Received: from [192.168.86.235] (c-67-180-167-114.hsd1.ca.comcast.net. [67.180.167.114]) by smtp.gmail.com with ESMTPSA id z184-v6sm2605028pgd.83.2018.08.02.06.08.35 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 02 Aug 2018 06:08:35 -0700 (PDT) Subject: Re: [PATCH 1/1] selftest/net: fix FILE_SIZE for 32 bit architecture. To: Maninder Singh , davem@davemloft.net, shuahkh@osg.samsung.com Cc: netdev@vger.kernel.org, linux-api@vger.kernel.org, linux-kernel@vger.kernel.org, edumazet@google.com, pankaj.m@samsung.com, a.sahrawat@samsung.com, Vaneet Narang References: <20180802103616epcas5p48ec1e2ea3568b11683aa7b55254dffb0~HCuTv0d7l2131721317epcas5p4u@epcas5p4.samsung.com> From: Eric Dumazet Message-ID: <4a412194-99aa-7969-54a4-727368fbf82c@gmail.com> Date: Thu, 2 Aug 2018 06:08:34 -0700 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.6.0 MIME-Version: 1.0 In-Reply-To: <20180802103616epcas5p48ec1e2ea3568b11683aa7b55254dffb0~HCuTv0d7l2131721317epcas5p4u@epcas5p4.samsung.com> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 08/02/2018 03:31 AM, Maninder Singh wrote: > FILE_SZ is defined as (1UL << 35), it will overflow > for 32 bit system and logic will break. > > Signed-off-by: Maninder Singh > Signed-off-by: Vaneet Narang > --- > 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 e8c5dff..1d6ca12 100644 > --- a/tools/testing/selftests/net/tcp_mmap.c > +++ b/tools/testing/selftests/net/tcp_mmap.c > @@ -85,7 +85,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; > @@ -134,7 +134,7 @@ void hash_zone(void *zone, unsigned int length) > > void *child_thread(void *arg) > { > - unsigned long total_mmap = 0, total = 0; > + unsigned long long total_mmap = 0, total = 0; > struct tcp_zerocopy_receive zc; > unsigned long delta_usec; > int flags = MAP_SHARED; > @@ -316,7 +316,7 @@ int main(int argc, char *argv[]) > { > struct sockaddr_storage listenaddr, addr; > unsigned int max_pacing_rate = 0; > - unsigned long total = 0; > + unsigned long long total = 0; > char *host = NULL; > int fd, c, on = 1; > char *buffer; > @@ -431,7 +431,7 @@ int main(int argc, char *argv[]) > zflg = 0; > } > while (total < FILE_SZ) { > - long wr = FILE_SZ - total; > + unsigned long long wr = FILE_SZ - total; > > if (wr > chunk_size) > wr = chunk_size; > What about using more conventional size_t instead of "unsigned long long" ?