Received: by 2002:a6b:500f:0:0:0:0:0 with SMTP id e15csp478373iob; Wed, 18 May 2022 06:25:43 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzfFe1uJxtmkMtfi5in1SHgaYSBEssl+earKgyevYjkJajjTYktAp4IubNkiu7jhlHEoaC5 X-Received: by 2002:a63:1762:0:b0:3db:3306:da60 with SMTP id 34-20020a631762000000b003db3306da60mr23131587pgx.23.1652880342807; Wed, 18 May 2022 06:25:42 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1652880342; cv=none; d=google.com; s=arc-20160816; b=K7B/80phPtZCk93m6iAcgYlnyv822i0p6iQpyq5uwwHT+1bNAO6McP37cSLwzOdTfp 4aZms74MwAA00Vizs2NJV8kPVi5qFQ/akMQGpc/+arB4N3jiVaL3tvxnb1Ghb/wvRrc7 EHVGE9t41djIeaafHCUmWy7iqWyaKOSKHiNiEu95MU6EQljViRHdv/gZoi1SFYq7xXao Ve4hcqmQESYQbx+FiP/3oHfTljXlRfdEgIUeHBROvKMzz1d9Rad9SdQiJ9VuVWxB5IHE ilcpY8OCrKesaCeH/wmWl/OaWANX/CwKQ0BBu38Xk7My1/VhtNwq6QDoNlC2m8Kdzg9s WDvg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=ihdUgHGtxRA6stOCfA5fnKVB7GMixDLtzRHuHbALlB8=; b=xcURdZFOyB1gRUl05iWwTu79eTAkReALkvPBufUcX9BPx20wJ9pR3LjCFolpS6dXRh 5V4/SVR7Lw2JsCdHoDACbUC4Zox8Jg6zUmwkBh4JFYPFhUQUjSiziQmDA8lIcP9bn1Ut LyZ5Q5bLuOGwrs94pepZOhRa42gYiZPs1LuFhtAsuWGDWz8K9yrE9L49jaSghHsqx1a5 Apw/zIeCAnb70CKgKBo+rELM92khH4PwGPW4ttIE0qK08BtplPRSJVEztc6YTYjVzTZG 4hHcUCDhNjJJ2W++Fl4/t48KhNWqKT5iAUoW/zrqaGf8zxPELFPFT0AytsqRcH2EYo4z pRNw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@infradead.org header.s=bombadil.20210309 header.b=v3p1hKVh; spf=softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from lindbergh.monkeyblade.net (lindbergh.monkeyblade.net. [23.128.96.19]) by mx.google.com with ESMTPS id h19-20020a170902eed300b00153b2d16545si2640538plb.333.2022.05.18.06.25.42 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 18 May 2022 06:25:42 -0700 (PDT) Received-SPF: softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 as permitted sender) client-ip=23.128.96.19; Authentication-Results: mx.google.com; dkim=pass header.i=@infradead.org header.s=bombadil.20210309 header.b=v3p1hKVh; spf=softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 69D8914AA40; Wed, 18 May 2022 06:23:03 -0700 (PDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S237737AbiERNWy (ORCPT + 99 others); Wed, 18 May 2022 09:22:54 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60386 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S237733AbiERNWj (ORCPT ); Wed, 18 May 2022 09:22:39 -0400 Received: from bombadil.infradead.org (bombadil.infradead.org [IPv6:2607:7c80:54:e::133]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B041B14AA42; Wed, 18 May 2022 06:22:36 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=bombadil.20210309; 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; bh=ihdUgHGtxRA6stOCfA5fnKVB7GMixDLtzRHuHbALlB8=; b=v3p1hKVhh7EK2y/rJO7fazBMbn GN9B+bx69HftB1ju+Jmp8ttle3b2cQD5TekZYjkbreJIpazJSS6cZeFxfmmWZa2eDRu0SVJFUxHRL vzkPksdYv9ETlr3UmN++A8Q0IQ9Vjg938iIPLDJ8kGwCdt0JkxoKKwkOcs0DJoge5Ccls0wlG72Kb NeZCC6AOi1u+P0xAiRbY8ZZlTenq3+s14TU39fJayiu37qcHsKAhXZBR0Rg8FBIhkogB21SDwuhZc eQ43GpC0nI5wcgcbK2UNuZvNJdDETUMe+9kM7xt2J49V31F9vODHSqdsyJVNrWE0JGKri1HEowl6E OqaoH+xA==; Received: from hch by bombadil.infradead.org with local (Exim 4.94.2 #2 (Red Hat Linux)) id 1nrJdJ-002HKN-PI; Wed, 18 May 2022 13:22:33 +0000 Date: Wed, 18 May 2022 06:22:33 -0700 From: Christoph Hellwig To: Vasily Averin Cc: Christoph Hellwig , Jan Kara , Christian Brauner , kernel@openvz.org, linux-kernel@vger.kernel.org, Alexander Viro , Amir Goldstein , Matthew Bobrowski , linux-fsdevel@vger.kernel.org Subject: Re: [PATCH v2] sparse: fix incorrect fmode_t casts Message-ID: References: <86e82d40-0952-e76f-aac5-53abe48ec770@openvz.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <86e82d40-0952-e76f-aac5-53abe48ec770@openvz.org> X-SRS-Rewrite: SMTP reverse-path rewritten from by bombadil.infradead.org. See http://www.infradead.org/rpr.html X-Spam-Status: No, score=-2.0 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,RDNS_NONE,SPF_HELO_NONE,T_SCC_BODY_TEXT_LINE autolearn=no autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org The fanotify and open.c changes looks fine, but should be split into one each with a proper subject and description. For procfs something simpler like the patch below might be a better option: diff --git a/fs/proc/base.c b/fs/proc/base.c index c1031843cc6aa..c07c6b51f0cb9 100644 --- a/fs/proc/base.c +++ b/fs/proc/base.c @@ -2237,13 +2237,13 @@ static struct dentry * proc_map_files_instantiate(struct dentry *dentry, struct task_struct *task, const void *ptr) { - fmode_t mode = (fmode_t)(unsigned long)ptr; + const fmode_t *mode = ptr; struct proc_inode *ei; struct inode *inode; inode = proc_pid_make_inode(dentry->d_sb, task, S_IFLNK | - ((mode & FMODE_READ ) ? S_IRUSR : 0) | - ((mode & FMODE_WRITE) ? S_IWUSR : 0)); + ((*mode & FMODE_READ ) ? S_IRUSR : 0) | + ((*mode & FMODE_WRITE) ? S_IWUSR : 0)); if (!inode) return ERR_PTR(-ENOENT); @@ -2294,7 +2294,7 @@ static struct dentry *proc_map_files_lookup(struct inode *dir, if (vma->vm_file) result = proc_map_files_instantiate(dentry, task, - (void *)(unsigned long)vma->vm_file->f_mode); + &vma->vm_file->f_mode); out_no_vma: mmap_read_unlock(mm); @@ -2391,7 +2391,7 @@ proc_map_files_readdir(struct file *file, struct dir_context *ctx) buf, len, proc_map_files_instantiate, task, - (void *)(unsigned long)p->mode)) + &p->mode)) break; ctx->pos++; }