Received: by 2002:ac0:a5b6:0:0:0:0:0 with SMTP id m51-v6csp2368081imm; Thu, 7 Jun 2018 09:27:32 -0700 (PDT) X-Google-Smtp-Source: ADUXVKLr3j7JyxqYt4+vwtrk0ec0bDmJ63x/200hUwfgrM78yd+w/JHEKodR15kErHS3yPKnT7pH X-Received: by 2002:a62:e70e:: with SMTP id s14-v6mr2404710pfh.131.1528388852572; Thu, 07 Jun 2018 09:27:32 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1528388852; cv=none; d=google.com; s=arc-20160816; b=Zl3XcMKheV8O9+sg891/NtyFERoesuuIb0rAlWroUd+zjAodhlGw5ldtWz2zYUh+0V huuuo13DLWP7bCk/8kXuJSUo+0B29zrvEl6WPH07J/RZbQP0eMj5LxdoLNNHSzhaDuPZ eRYE0MIpwb97I86GkFlsU3ZG5GH64O4hPcrlP7i6b4daVN7E73/IXmWlbIm20Z105IPn FVqWCtLs24ovny6ZoUOoR/M7Xf1QGGZEs194t0740hf1YnLarE6fa8DswuKpVDSjHg7a S3VLxOw5NJ1YCOCBH/tTV7ofP16lqPsbXzibf1xlIV7z8bti2hCagE/bZmXDn9Vh1TOk i+4g== 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:mime-version :message-id:date:subject:cc:to:from:arc-authentication-results; bh=JQhHUSOS/V1N90zGXJcAoGSe0PMn9OMHHk8WNS35/Ho=; b=L3S1KlAnLRs5Q5tWlHVrus/BfzuPw0mAXNqpQAWjHfeflUO4e9E82X1z+T3bgjTSve SwFiGCjA0WxHHLNXSwCG2hB2/y4lYQNg2A+sLIRib10/jOtlqP6g90Vvvt2iEElVpooj U4vlxNCyTQzOfYbPYPfSpPhvkmiaj9qhWg+GUMW9Xv8i/QHYvb39iuS9YAtJgyngMATz lzcBnfDng3udsgGA63JXyAA/E+SlVOswM0IPJucdsdkjsyzdPUlq13f6lI1F463N4DAi G1zeaSsNnC0ock4MkvyGJwB8bhDjF1l30Apipymb1qIRctm8uviZX84Q8hG0TiU05tIN 2baw== ARC-Authentication-Results: i=1; mx.google.com; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id t1-v6si10297879pgc.606.2018.06.07.09.27.17; Thu, 07 Jun 2018 09:27:32 -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; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932763AbeFGNhj (ORCPT + 99 others); Thu, 7 Jun 2018 09:37:39 -0400 Received: from baptiste.telenet-ops.be ([195.130.132.51]:44220 "EHLO baptiste.telenet-ops.be" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932586AbeFGNhi (ORCPT ); Thu, 7 Jun 2018 09:37:38 -0400 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 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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 --- 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; -- 2.7.4