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 Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 912B5C433EF for ; Wed, 18 May 2022 13:22:57 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S237706AbiERNWz (ORCPT ); Wed, 18 May 2022 09:22:55 -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 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++; }