Received: by 2002:ac0:bc90:0:0:0:0:0 with SMTP id a16csp989031img; Mon, 18 Mar 2019 20:23:00 -0700 (PDT) X-Google-Smtp-Source: APXvYqx/TOtvGkRI/KCrMNv+eVL8iu2jXsHV7wG1fe9zcVUIR9ue/dnkCrW2GLgfhw1yl0tZ4juJ X-Received: by 2002:a63:2b82:: with SMTP id r124mr20730133pgr.214.1552965780314; Mon, 18 Mar 2019 20:23:00 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1552965780; cv=none; d=google.com; s=arc-20160816; b=0ZR/0IX1yAXwnbXX6Z/7jSZ4aHIvwv+T72z9VyOu7EHqCxlkqjugClz9q4NHycSqKY HyB/r1f1yixKvg6A1m5a/Y/fhoWq/BDyZnZUHMgJre7YFZmPMadzLh3951AQBM3wB69D 1LlRL7vAB2HkqsIctUxJh1o/u939y0y/oknJYqGTyqgfkiPhuiwKcvgBGksr4jhD0MNO 27Y/d7WxbOU3MAlb9G3dfL/QSHWGRa3/ROMOZ4Tx/US8hYIcIqueAzq/qRSYh68ZjKu8 /1FG558gZsJYRJVssJZnbdgWPm1gdocCYD86g6Gq8nvslPd/I6tPDNhkJtwFDPOW91OE lqgw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:dkim-signature; bh=/V7IAbYs1Yh2i9HUpcwUEqrMPRSzKDvNnL8WwA2sS9Q=; b=mKmbnS4TmrGQPMRLPB2TTH46L7iKZt+ZK3nR+R38IZ9cjyrFfLj8697SeEkIwGMPTY xSBqTZlrsnMdCX2dx06weAo4VTyUiqcg1wr1D8vANOn0De+C+1ZNpMliBI0L7ZqCM50Q GmKM+AXITYgpRersyaGsNGWbvZy76tCC3XgSZ2mL5e4gPVzCZ3HXdNCbrSp1Zpa+8g0g 9G0gvcAfpeEs6KpacScIk6wamHOIuxPmrxhsLICnrGPNb7hJG0zxvVFURKWQMPobaAxg xOi/Kgnq8mXdYFc2/wlckttfxsaJ8oIOixFslFmzyzoPO/buDENumZ1jgv++VL9foMdb KT4w== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@infradead.org header.s=bombadil.20170209 header.b=I4tWEvZI; 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 q6si10828518pll.130.2019.03.18.20.22.45; Mon, 18 Mar 2019 20:23:00 -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=neutral (body hash did not verify) header.i=@infradead.org header.s=bombadil.20170209 header.b=I4tWEvZI; 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 S1727481AbfCSDUZ (ORCPT + 99 others); Mon, 18 Mar 2019 23:20:25 -0400 Received: from bombadil.infradead.org ([198.137.202.133]:48436 "EHLO bombadil.infradead.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726817AbfCSDUZ (ORCPT ); Mon, 18 Mar 2019 23:20:25 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=bombadil.20170209; h=In-Reply-To:Content-Type:MIME-Version :References:Message-ID:Subject:Cc:To:From:Date:Sender:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Id: List-Help:List-Unsubscribe:List-Subscribe:List-Post:List-Owner:List-Archive; bh=8cOcRzjIwTqLzjM51anaSwI2gAP+jsx+4ZN5gqnYUgE=; b=I4tWEvZIfSkzZB9k50MhjOS+p OupUFBYVK9RTV1208k82etZeYqgiZABof5TObr7F4uODnqxm1rp+Epk+pBDi21EJHjcjrqHh84bU9 3uuM5SbyIAl6k64S4xjNsY74mYgVvfXZ4g7J2Paiw+pMd931xxFT7/AQoJCpwgkDY69mu5YFoxQi2 +00fZoYebqxvS4s3iC7fMjUMNSBtu5/GcO2Vt2iVRPMjt9gbkj3DKtDKkTUaq4Nf9/obdcEv7TTB6 ++iBelLhkwhg/WgFK+PyjNzNaewYeJbuKnJxNzhZt0QT8jHNfKYl65tw8QHvSxnfkuCzKqvfm1csK WH9aQnbsA==; Received: from willy by bombadil.infradead.org with local (Exim 4.90_1 #2 (Red Hat Linux)) id 1h65Ic-00074L-LW; Tue, 19 Mar 2019 03:20:22 +0000 Date: Mon, 18 Mar 2019 20:20:22 -0700 From: Matthew Wilcox To: Souptick Joarder Cc: akpm@linux-foundation.org, mike.kravetz@oracle.com, linux-mm@kvack.org, linux-kernel@vger.kernel.org, linux-sparse@vger.kernel.org Subject: Re: [PATCH] include/linux/hugetlb.h: Convert to use vm_fault_t Message-ID: <20190319032022.GR19508@bombadil.infradead.org> References: <20190318162604.GA31553@jordon-HP-15-Notebook-PC> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20190318162604.GA31553@jordon-HP-15-Notebook-PC> User-Agent: Mutt/1.9.2 (2017-12-15) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, Mar 18, 2019 at 09:56:05PM +0530, Souptick Joarder wrote: > >> mm/memory.c:3968:21: sparse: incorrect type in assignment (different > >> base types) @@ expected restricted vm_fault_t [usertype] ret @@ > >> got e] ret @@ > mm/memory.c:3968:21: expected restricted vm_fault_t [usertype] ret > mm/memory.c:3968:21: got int I think this may be a sparse bug. Compare: +++ b/mm/memory.c @@ -3964,6 +3964,9 @@ vm_fault_t handle_mm_fault(struct vm_area_struct *vma, unsigned long address, if (flags & FAULT_FLAG_USER) mem_cgroup_enter_user_fault(); + ret = 0; + ret = ({ BUG(); 0; }); + ret = 1; if (unlikely(is_vm_hugetlb_page(vma))) ret = hugetlb_fault(vma->vm_mm, vma, address, flags); else ../mm/memory.c:3968:13: sparse: warning: incorrect type in assignment (different base types) ../mm/memory.c:3968:13: sparse: expected restricted vm_fault_t [assigned] [usertype] ret ../mm/memory.c:3968:13: sparse: got int ../mm/memory.c:3969:13: sparse: warning: incorrect type in assignment (different base types) ../mm/memory.c:3969:13: sparse: expected restricted vm_fault_t [assigned] [usertype] ret ../mm/memory.c:3969:13: sparse: got int vm_fault_t is __bitwise: include/linux/mm_types.h:typedef __bitwise unsigned int vm_fault_t; so simply assigning 0 to ret should work (and does on line 3967), but sparse doesn't seem to like it as part of a ({ .. }) expression.