From patchwork Thu Jun 7 13:37:34 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Geert Uytterhoeven X-Patchwork-Id: 10451869 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 5B86160467 for ; Thu, 7 Jun 2018 13:37:41 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 4AFA429406 for ; Thu, 7 Jun 2018 13:37:41 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 3F98129F47; Thu, 7 Jun 2018 13:37:41 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-2.9 required=2.0 tests=BAYES_00, MAILING_LIST_MULTI, RCVD_IN_DNSWL_NONE autolearn=ham version=3.3.1 Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 1A17829406 for ; Thu, 7 Jun 2018 13:37:40 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 3A4636B0007; Thu, 7 Jun 2018 09:37:39 -0400 (EDT) Delivered-To: linux-mm-outgoing@kvack.org Received: by kanga.kvack.org (Postfix, from userid 40) id 353196B0008; Thu, 7 Jun 2018 09:37:39 -0400 (EDT) X-Original-To: int-list-linux-mm@kvack.org X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 243086B000A; Thu, 7 Jun 2018 09:37:39 -0400 (EDT) X-Original-To: linux-mm@kvack.org X-Delivered-To: linux-mm@kvack.org Received: from mail-wr0-f200.google.com (mail-wr0-f200.google.com [209.85.128.200]) by kanga.kvack.org (Postfix) with ESMTP id BE4856B0007 for ; Thu, 7 Jun 2018 09:37:38 -0400 (EDT) Received: by mail-wr0-f200.google.com with SMTP id k12-v6so5493917wrl.21 for ; Thu, 07 Jun 2018 06:37:38 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-original-authentication-results:x-gm-message-state:from:to:cc :subject:date:message-id:mime-version:content-transfer-encoding; bh=JQhHUSOS/V1N90zGXJcAoGSe0PMn9OMHHk8WNS35/Ho=; b=i986o6WsGdbFkBCbTSSt4mdvwHZm42uo4XtoVYn+56Ln7vrroA1uDZY3XlXakaeNZG paYrdxIXI7IYSSzKlCb+hwQiJk5vTfTPY7YffxcZQ7cfcREEPMMm3DdhZFUEDYRgXbdZ djqzmXnxq/aRWp1wONrBx7EbcC6G2toLpwFAlk7jDbHT5JUBaHxjNuqBwB+ZkJBpqSZH ChTJv4+BafWSj3/J9JrDQO81Nmm0w6VEv+y+P2sEYodIYsd1OAkTCUkxqtYD0IpQCfnb 12lv7hINlO+av3T/jqrIPaRfSoHMNuWBcPoCU5Xeuo6PLH32/AfZpl0jTJDA/abV8k4v nezQ== X-Original-Authentication-Results: mx.google.com; spf=neutral (google.com: 2a02:1800:120:4::f00:13 is neither permitted nor denied by best guess record for domain of geert@linux-m68k.org) smtp.mailfrom=geert@linux-m68k.org X-Gm-Message-State: APt69E380lvli14HO1h5Ln4xHIiLvIytgIIPNKVfzvAOW1iKFcilVXpt NDGbwC9V1MBi6SVhkYp/eFwIKiK5E3i+T3gDPaKBSR9Ejcch2+sGlZ+tMo+KMqp2X+xoqcbVJHn IUx+PE6PeED3N7SBgBGX/1OboH4amK4KP79dhe/VIfWoIe8xaAd0CvT+aynMmB8I= X-Received: by 2002:adf:858f:: with SMTP id 15-v6mr1901369wrt.31.1528378658327; Thu, 07 Jun 2018 06:37:38 -0700 (PDT) X-Google-Smtp-Source: ADUXVKKJM52lRrDlzRBTBlDckIxpljkv1U9KgDkDN5BwtIFNBCMfxED/Revjnnbuj5ObQ/Mf/iCP X-Received: by 2002:adf:858f:: with SMTP id 15-v6mr1901318wrt.31.1528378657291; Thu, 07 Jun 2018 06:37:37 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1528378657; cv=none; d=google.com; s=arc-20160816; b=W1nxUUiqHDTSNzsP1dE4Ysme17j+N15Tqg2bi9rc+mhY7WktikJ8O8gHEd2ErZMJFd QEl4wXKN79HCJ/Ftnivqt8cn6UeD5Tq7F2PgaCXqQNQCGDbFD7C7AMv9ZSXO6cw4O6vb Vmk88LJT8RBJfi/FMG/0YK3DnrMpG4nfeUxgfd4JDvLANDrhnbJjVsQc6JsoxBda+S+j YfK8APa+j6ccyklC+ut1SFhIRCWN3Kb+Km3SAOhZPuFGEH7icHAcZMz1JTG6mez7S9ir eRAZHJujtbJJP78NiYU+XMzb0/fGeChlDzhzBVcpOMcSyn5AuulkjjQTPkq0U0SQKFYE oRWw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:arc-authentication-results; bh=JQhHUSOS/V1N90zGXJcAoGSe0PMn9OMHHk8WNS35/Ho=; b=YXOwIqUYztE6I4+xntdtV48sMsMDhq4u51DQNzceEjb5jh1qfRjwhIChO73cfYA2/H L1sZQ0HIKslbrczo16nl8KjMj8EMIsh+RDf7HRLaI9zKW8jmHtb1slKwY+UndsZMkRAY tQWLESJrgRCD4ULkkyqrgkgaUav+e27tNv1mwfutO15mRPRlqr8Yi7WIPdV5WbGWoSev 25h5ZHq0W5/VQLg/q/AjBteHBxed3PC2OOJQB4nWG/oc2VH4tSNzY6bnhk/24BFA3nzP NeUWGkdw2pVCBlvIa5b2JW3d7bGgLKxisX1n1OZUzw5SEIsGCCuB/wgjbTaW1fpP64lL gSLg== ARC-Authentication-Results: i=1; mx.google.com; spf=neutral (google.com: 2a02:1800:120:4::f00:13 is neither permitted nor denied by best guess record for domain of geert@linux-m68k.org) smtp.mailfrom=geert@linux-m68k.org Received: from baptiste.telenet-ops.be (baptiste.telenet-ops.be. [2a02:1800:120:4::f00:13]) by mx.google.com with ESMTPS id o15-v6si7239772wrh.142.2018.06.07.06.37.37 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 07 Jun 2018 06:37:37 -0700 (PDT) Received-SPF: neutral (google.com: 2a02:1800:120:4::f00:13 is neither permitted nor denied by best guess record for domain of geert@linux-m68k.org) client-ip=2a02:1800:120:4::f00:13; Authentication-Results: mx.google.com; spf=neutral (google.com: 2a02:1800:120:4::f00:13 is neither permitted nor denied by best guess record for domain of geert@linux-m68k.org) smtp.mailfrom=geert@linux-m68k.org Received: from ayla.of.borg ([84.194.111.163]) by baptiste.telenet-ops.be with bizsmtp id vpdc1x00C3XaVaC01pdcYe; Thu, 07 Jun 2018 15:37:37 +0200 Received: from ramsan.of.borg ([192.168.97.29] helo=ramsan) by ayla.of.borg with esmtp (Exim 4.86_2) (envelope-from ) id 1fQv6e-0000CV-1x; Thu, 07 Jun 2018 15:37:36 +0200 Received: from geert by ramsan with local (Exim 4.86_2) (envelope-from ) id 1fQv6d-0000Od-VM; Thu, 07 Jun 2018 15:37:35 +0200 From: Geert Uytterhoeven To: "David S . Miller" , =?UTF-8?q?Bj=C3=B6rn=20T=C3=B6pel?= , Magnus Karlsson , Alexei Starovoitov Cc: Arnd Bergmann , Andrew Morton , netdev@vger.kernel.org, linux-mm@kvack.org, linux-kernel@vger.kernel.org, Geert Uytterhoeven Subject: [PATCH] xsk: Fix umem fill/completion queue mmap on 32-bit Date: Thu, 7 Jun 2018 15:37:34 +0200 Message-Id: <1528378654-1484-1-git-send-email-geert@linux-m68k.org> X-Mailer: git-send-email 2.7.4 MIME-Version: 1.0 X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: X-Virus-Scanned: ClamAV using ClamSMTP With gcc-4.1.2 on 32-bit: net/xdp/xsk.c:663: warning: integer constant is too large for ‘long’ type net/xdp/xsk.c:665: warning: integer constant is too large for ‘long’ type Add the missing "ULL" suffixes to the large XDP_UMEM_PGOFF_*_RING values to fix this. net/xdp/xsk.c:663: warning: comparison is always false due to limited range of data type net/xdp/xsk.c:665: warning: comparison is always false due to limited range of data type "unsigned long" is 32-bit on 32-bit systems, hence the offset is truncated, and can never be equal to any of the XDP_UMEM_PGOFF_*_RING values. Use loff_t (and the required cast) to fix this. Fixes: 423f38329d267969 ("xsk: add umem fill queue support and mmap") Fixes: fe2308328cd2f26e ("xsk: add umem completion queue support and mmap") Signed-off-by: Geert Uytterhoeven Acked-by: Björn Töpel --- Compile-tested only. --- include/uapi/linux/if_xdp.h | 4 ++-- net/xdp/xsk.c | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/include/uapi/linux/if_xdp.h b/include/uapi/linux/if_xdp.h index 1fa0e977ea8d0224..caed8b1614ffc0aa 100644 --- a/include/uapi/linux/if_xdp.h +++ b/include/uapi/linux/if_xdp.h @@ -63,8 +63,8 @@ struct xdp_statistics { /* Pgoff for mmaping the rings */ #define XDP_PGOFF_RX_RING 0 #define XDP_PGOFF_TX_RING 0x80000000 -#define XDP_UMEM_PGOFF_FILL_RING 0x100000000 -#define XDP_UMEM_PGOFF_COMPLETION_RING 0x180000000 +#define XDP_UMEM_PGOFF_FILL_RING 0x100000000ULL +#define XDP_UMEM_PGOFF_COMPLETION_RING 0x180000000ULL /* Rx/Tx descriptor */ struct xdp_desc { diff --git a/net/xdp/xsk.c b/net/xdp/xsk.c index c6ed2454f7ce55e8..36919a254ba370c3 100644 --- a/net/xdp/xsk.c +++ b/net/xdp/xsk.c @@ -643,7 +643,7 @@ static int xsk_getsockopt(struct socket *sock, int level, int optname, static int xsk_mmap(struct file *file, struct socket *sock, struct vm_area_struct *vma) { - unsigned long offset = vma->vm_pgoff << PAGE_SHIFT; + loff_t offset = (loff_t)vma->vm_pgoff << PAGE_SHIFT; unsigned long size = vma->vm_end - vma->vm_start; struct xdp_sock *xs = xdp_sk(sock->sk); struct xsk_queue *q = NULL;