From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-5.5 required=3.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS, USER_AGENT_SANE_1 autolearn=no autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id CCEF1C433DF for ; Tue, 21 Jul 2020 05:23:33 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id AAADA208E4 for ; Tue, 21 Jul 2020 05:23:33 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726310AbgGUFXc (ORCPT ); Tue, 21 Jul 2020 01:23:32 -0400 Received: from verein.lst.de ([213.95.11.211]:50572 "EHLO verein.lst.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725774AbgGUFXc (ORCPT ); Tue, 21 Jul 2020 01:23:32 -0400 Received: by verein.lst.de (Postfix, from userid 2407) id B86216736F; Tue, 21 Jul 2020 07:23:26 +0200 (CEST) Date: Tue, 21 Jul 2020 07:23:26 +0200 From: Christoph Hellwig To: Luc Van Oostenryck Cc: Christoph Hellwig , "David S. Miller" , Jakub Kicinski , Alexei Starovoitov , Daniel Borkmann , Alexey Kuznetsov , Hideaki YOSHIFUJI , Eric Dumazet , linux-crypto@vger.kernel.org, linux-kernel@vger.kernel.org, netdev@vger.kernel.org, bpf@vger.kernel.org, netfilter-devel@vger.kernel.org, coreteam@netfilter.org, linux-sctp@vger.kernel.org, linux-hams@vger.kernel.org, linux-bluetooth@vger.kernel.org, bridge@lists.linux-foundation.org, linux-can@vger.kernel.org, dccp@vger.kernel.org, linux-decnet-user@lists.sourceforge.net, linux-wpan@vger.kernel.org, linux-s390@vger.kernel.org, mptcp@lists.01.org, lvs-devel@vger.kernel.org, rds-devel@oss.oracle.com, linux-afs@lists.infradead.org, tipc-discussion@lists.sourceforge.net, linux-x25@vger.kernel.org Subject: Re: [PATCH 02/24] bpfilter: fix up a sparse annotation Message-ID: <20200721052326.GA10071@lst.de> References: <20200720124737.118617-1-hch@lst.de> <20200720124737.118617-3-hch@lst.de> <20200721024016.2talwdt5hjqvirr6@ltop.local> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20200721024016.2talwdt5hjqvirr6@ltop.local> User-Agent: Mutt/1.5.17 (2007-11-01) Sender: bpf-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: bpf@vger.kernel.org On Tue, Jul 21, 2020 at 04:40:16AM +0200, Luc Van Oostenryck wrote: > > req.pid = current->pid; > > req.cmd = optname; > > - req.addr = (long __force __user)optval; > > + req.addr = (__force long)optval; > > For casts to integers, even '__force' is not needed (since integers > can't be dereferenced, the concept of address-space is meaningless > for them, so it's never useful to warn when it's dropped and > '__force' is thus not needed). That's what I thought. but if I remove it here I actually do get a warning: CHECK net/bpfilter/bpfilter_kern.c net/bpfilter/bpfilter_kern.c:52:21: warning: cast removes address space '__user' of expression Using this recent sparse build: hch@brick:~/work/linux$ sparse --version v0.6.2-49-g707c5017 From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Date: Tue, 21 Jul 2020 07:23:26 +0200 From: Christoph Hellwig Message-ID: <20200721052326.GA10071@lst.de> References: <20200720124737.118617-1-hch@lst.de> <20200720124737.118617-3-hch@lst.de> <20200721024016.2talwdt5hjqvirr6@ltop.local> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20200721024016.2talwdt5hjqvirr6@ltop.local> Subject: Re: [Bridge] [PATCH 02/24] bpfilter: fix up a sparse annotation List-Id: Linux Ethernet Bridging List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Luc Van Oostenryck Cc: Alexei Starovoitov , linux-sctp@vger.kernel.org, Christoph Hellwig , linux-s390@vger.kernel.org, rds-devel@oss.oracle.com, Daniel Borkmann , dccp@vger.kernel.org, bridge@lists.linux-foundation.org, linux-afs@lists.infradead.org, lvs-devel@vger.kernel.org, coreteam@netfilter.org, mptcp@lists.01.org, Alexey Kuznetsov , linux-can@vger.kernel.org, Jakub Kicinski , linux-hams@vger.kernel.org, tipc-discussion@lists.sourceforge.net, linux-x25@vger.kernel.org, Eric Dumazet , Hideaki YOSHIFUJI , netdev@vger.kernel.org, linux-decnet-user@lists.sourceforge.net, linux-kernel@vger.kernel.org, linux-bluetooth@vger.kernel.org, netfilter-devel@vger.kernel.org, linux-crypto@vger.kernel.org, bpf@vger.kernel.org, linux-wpan@vger.kernel.org, "David S. Miller" On Tue, Jul 21, 2020 at 04:40:16AM +0200, Luc Van Oostenryck wrote: > > req.pid = current->pid; > > req.cmd = optname; > > - req.addr = (long __force __user)optval; > > + req.addr = (__force long)optval; > > For casts to integers, even '__force' is not needed (since integers > can't be dereferenced, the concept of address-space is meaningless > for them, so it's never useful to warn when it's dropped and > '__force' is thus not needed). That's what I thought. but if I remove it here I actually do get a warning: CHECK net/bpfilter/bpfilter_kern.c net/bpfilter/bpfilter_kern.c:52:21: warning: cast removes address space '__user' of expression Using this recent sparse build: hch@brick:~/work/linux$ sparse --version v0.6.2-49-g707c5017 From mboxrd@z Thu Jan 1 00:00:00 1970 From: Christoph Hellwig Date: Tue, 21 Jul 2020 05:23:26 +0000 Subject: Re: [PATCH 02/24] bpfilter: fix up a sparse annotation Message-Id: <20200721052326.GA10071@lst.de> List-Id: References: <20200720124737.118617-3-hch@lst.de> In-Reply-To: <20200720124737.118617-3-hch@lst.de> MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit To: dccp@vger.kernel.org On Tue, Jul 21, 2020 at 04:40:16AM +0200, Luc Van Oostenryck wrote: > > req.pid = current->pid; > > req.cmd = optname; > > - req.addr = (long __force __user)optval; > > + req.addr = (__force long)optval; > > For casts to integers, even '__force' is not needed (since integers > can't be dereferenced, the concept of address-space is meaningless > for them, so it's never useful to warn when it's dropped and > '__force' is thus not needed). That's what I thought. but if I remove it here I actually do get a warning: CHECK net/bpfilter/bpfilter_kern.c net/bpfilter/bpfilter_kern.c:52:21: warning: cast removes address space '__user' of expression Using this recent sparse build: hch@brick:~/work/linux$ sparse --version v0.6.2-49-g707c5017 From mboxrd@z Thu Jan 1 00:00:00 1970 From: Christoph Hellwig Subject: Re: [PATCH 02/24] bpfilter: fix up a sparse annotation Date: Tue, 21 Jul 2020 07:23:26 +0200 Message-ID: <20200721052326.GA10071@lst.de> References: <20200720124737.118617-1-hch@lst.de> <20200720124737.118617-3-hch@lst.de> <20200721024016.2talwdt5hjqvirr6@ltop.local> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Return-path: Content-Disposition: inline In-Reply-To: <20200721024016.2talwdt5hjqvirr6@ltop.local> Sender: netfilter-devel-owner@vger.kernel.org To: Luc Van Oostenryck Cc: Christoph Hellwig , "David S. Miller" , Jakub Kicinski , Alexei Starovoitov , Daniel Borkmann , Alexey Kuznetsov , Hideaki YOSHIFUJI , Eric Dumazet , linux-crypto@vger.kernel.org, linux-kernel@vger.kernel.org, netdev@vger.kernel.org, bpf@vger.kernel.org, netfilter-devel@vger.kernel.org, coreteam@netfilter.org, linux-sctp@vger.kernel.org, linux-hams@vger.kernel.org, linux-bluetooth@vger.kernel.org, bridge@lists.linux-foundation.org, linux-can@vger.kernel.org, dccp@vger.kernel.org, linux-decnet-user@lists.sourceforge.net, linux-wpan@vger.kernel.org, linux-s390@vger.kernel.org, mptcp@lists.01.org, lvs-devel@ List-Id: linux-can.vger.kernel.org On Tue, Jul 21, 2020 at 04:40:16AM +0200, Luc Van Oostenryck wrote: > > req.pid = current->pid; > > req.cmd = optname; > > - req.addr = (long __force __user)optval; > > + req.addr = (__force long)optval; > > For casts to integers, even '__force' is not needed (since integers > can't be dereferenced, the concept of address-space is meaningless > for them, so it's never useful to warn when it's dropped and > '__force' is thus not needed). That's what I thought. but if I remove it here I actually do get a warning: CHECK net/bpfilter/bpfilter_kern.c net/bpfilter/bpfilter_kern.c:52:21: warning: cast removes address space '__user' of expression Using this recent sparse build: hch@brick:~/work/linux$ sparse --version v0.6.2-49-g707c5017 From mboxrd@z Thu Jan 1 00:00:00 1970 From: Christoph Hellwig Subject: Re: [PATCH 02/24] bpfilter: fix up a sparse annotation Date: Tue, 21 Jul 2020 07:23:26 +0200 Message-ID: <20200721052326.GA10071@lst.de> References: <20200720124737.118617-1-hch@lst.de> <20200720124737.118617-3-hch@lst.de> <20200721024016.2talwdt5hjqvirr6@ltop.local> Mime-Version: 1.0 Return-path: Content-Disposition: inline In-Reply-To: <20200721024016.2talwdt5hjqvirr6@ltop.local> Sender: netfilter-devel-owner@vger.kernel.org List-ID: Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit To: Luc Van Oostenryck Cc: Christoph Hellwig , "David S. Miller" , Jakub Kicinski , Alexei Starovoitov , Daniel Borkmann , Alexey Kuznetsov , Hideaki YOSHIFUJI , Eric Dumazet , linux-crypto@vger.kernel.org, linux-kernel@vger.kernel.org, netdev@vger.kernel.org, bpf@vger.kernel.org, netfilter-devel@vger.kernel.org, coreteam@netfilter.org, linux-sctp@vger.kernel.org, linux-hams@vger.kernel.org, linux-bluetooth@vger.kernel.org, bridge@lists.linux-foundation.org, linux-can@vger.kernel.org, dccp@vger.kernel.org, linux-decnet-user@lists.sourceforge.net, linux-wpan@vger.kernel.org, linux-s390@vger.kernel.org, mptcp@lists.01.org, On Tue, Jul 21, 2020 at 04:40:16AM +0200, Luc Van Oostenryck wrote: > > req.pid = current->pid; > > req.cmd = optname; > > - req.addr = (long __force __user)optval; > > + req.addr = (__force long)optval; > > For casts to integers, even '__force' is not needed (since integers > can't be dereferenced, the concept of address-space is meaningless > for them, so it's never useful to warn when it's dropped and > '__force' is thus not needed). That's what I thought. but if I remove it here I actually do get a warning: CHECK net/bpfilter/bpfilter_kern.c net/bpfilter/bpfilter_kern.c:52:21: warning: cast removes address space '__user' of expression Using this recent sparse build: hch@brick:~/work/linux$ sparse --version v0.6.2-49-g707c5017 From mboxrd@z Thu Jan 1 00:00:00 1970 From: Christoph Hellwig Date: Tue, 21 Jul 2020 05:23:26 +0000 Subject: Re: [PATCH 02/24] bpfilter: fix up a sparse annotation Message-Id: <20200721052326.GA10071@lst.de> List-Id: References: <20200720124737.118617-1-hch@lst.de> <20200720124737.118617-3-hch@lst.de> <20200721024016.2talwdt5hjqvirr6@ltop.local> In-Reply-To: <20200721024016.2talwdt5hjqvirr6@ltop.local> MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit To: Luc Van Oostenryck Cc: Christoph Hellwig , "David S. Miller" , Jakub Kicinski , Alexei Starovoitov , Daniel Borkmann , Alexey Kuznetsov , Hideaki YOSHIFUJI , Eric Dumazet , linux-crypto@vger.kernel.org, linux-kernel@vger.kernel.org, netdev@vger.kernel.org, bpf@vger.kernel.org, netfilter-devel@vger.kernel.org, coreteam@netfilter.org, linux-sctp@vger.kernel.org, linux-hams@vger.kernel.org, linux-bluetooth@vger.kernel.org, bridge@lists.linux-foundation.org, linux-can@vger.kernel.org, dccp@vger.kernel.org, linux-decnet-user@lists.sourceforge.net, linux-wpan@vger.kernel.org, linux-s390@vger.kernel.org, mptcp@lists.01.org, lvs-devel@vger.kernel.org, rds-devel@oss.oracle.com, linux-afs@lists.infradead.org, tipc-discussion@lists.sourceforge.net, linux-x25@vger.kernel.org On Tue, Jul 21, 2020 at 04:40:16AM +0200, Luc Van Oostenryck wrote: > > req.pid = current->pid; > > req.cmd = optname; > > - req.addr = (long __force __user)optval; > > + req.addr = (__force long)optval; > > For casts to integers, even '__force' is not needed (since integers > can't be dereferenced, the concept of address-space is meaningless > for them, so it's never useful to warn when it's dropped and > '__force' is thus not needed). That's what I thought. but if I remove it here I actually do get a warning: CHECK net/bpfilter/bpfilter_kern.c net/bpfilter/bpfilter_kern.c:52:21: warning: cast removes address space '__user' of expression Using this recent sparse build: hch@brick:~/work/linux$ sparse --version v0.6.2-49-g707c5017 From mboxrd@z Thu Jan 1 00:00:00 1970 Content-Type: multipart/mixed; boundary="===============3210968557008876476==" MIME-Version: 1.0 From: Christoph Hellwig To: mptcp at lists.01.org Subject: [MPTCP] Re: [PATCH 02/24] bpfilter: fix up a sparse annotation Date: Tue, 21 Jul 2020 07:23:26 +0200 Message-ID: <20200721052326.GA10071@lst.de> In-Reply-To: 20200721024016.2talwdt5hjqvirr6@ltop.local X-Status: X-Keywords: X-UID: 5137 --===============3210968557008876476== Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable On Tue, Jul 21, 2020 at 04:40:16AM +0200, Luc Van Oostenryck wrote: > > req.pid =3D current->pid; > > req.cmd =3D optname; > > - req.addr =3D (long __force __user)optval; > > + req.addr =3D (__force long)optval; > = > For casts to integers, even '__force' is not needed (since integers > can't be dereferenced, the concept of address-space is meaningless > for them, so it's never useful to warn when it's dropped and > '__force' is thus not needed). That's what I thought. but if I remove it here I actually do get a warning: CHECK net/bpfilter/bpfilter_kern.c net/bpfilter/bpfilter_kern.c:52:21: warning: cast removes address space '__= user' of expression Using this recent sparse build: hch(a)brick:~/work/linux$ sparse --version v0.6.2-49-g707c5017 --===============3210968557008876476==--