Received: by 2002:a05:6602:18e:0:0:0:0 with SMTP id m14csp1766657ioo; Mon, 23 May 2022 02:49:53 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwKHXdTCaPz3OVrXhZJEiZwUccKZodEnEolJCSjDnsnkTwrUNZ/2wvD/kDndWpukoMzHPL/ X-Received: by 2002:a17:903:44e:b0:161:58c6:77e5 with SMTP id iw14-20020a170903044e00b0016158c677e5mr22398584plb.81.1653299392856; Mon, 23 May 2022 02:49:52 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1653299392; cv=none; d=google.com; s=arc-20160816; b=DQnrS/AzPBpjT9Xr296SorMZP5SGdq3kXWPL8nzV4I88nzA2cLptBwoUNE9+0fF8AO gbamqey4fU6wP54Yb1I+2UfKmEcUcYwVo+d6d6XU+Un2GlmwPt09aH2KCyrrIsVB88dc cFM83OR6RNJADydYpxfx6v7VqxNkIsZAOJOqyIRqDeAlSTjIurlVYtZQ5owpaLOseOjm UNWx4QMRr+7Jw4XBYv6oB3+tZzDNQM0bKHGBgn+6+iV5BIzIX282p35oupYyfTT/RVXD 28fXPIj05cin+AHavXdTbSlKiwWjjlmpFbocn5Fje+7zbpYkPUU8aPSS5k23IRDEBN3x 9JkA== 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 :dkim-signature; bh=3BKZ8QhniRBwgmI0twD/d6abArIatMrZ0L88M4PIxAY=; b=nkXBh1oNnJTrjq62gM8AP0Jpeu/RHfD/q0/vNPMWYWUGXup73Og4opcOr3+fCMkXEA 4v/VSJwsAPZhU+aqGOWskSUq29rDgdLxHDZwdNzI0wtuH7EMw7cJuOB5/IwWuIzlitxG 9HdY6i9iCuhPIp6KkhfxLnhfzqUALGER/zFDDgrTyI6r7vVVMfzmLbuuOWigZ/WnRURs RQfmImIz0wEWhr3ftUi7eBShdNAZ7Jy5eh3hUdEGqOn1tgtTQEdA0Oo2dfk1Ehst+p6h Rpvz8pn55HGBtUq+rfRDbOiM1tSAawpL8KK/SOH78vN828zB9myddnfDKfq4PxLq/e84 OOOg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@suse.cz header.s=susede2_rsa header.b=pYnOFOL4; dkim=neutral (no key) header.i=@suse.cz; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from lindbergh.monkeyblade.net (lindbergh.monkeyblade.net. [2620:137:e000::1:18]) by mx.google.com with ESMTPS id b11-20020a056a000ccb00b00512e59d9bf9si14665707pfv.296.2022.05.23.02.49.52 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 23 May 2022 02:49:52 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) client-ip=2620:137:e000::1:18; Authentication-Results: mx.google.com; dkim=pass header.i=@suse.cz header.s=susede2_rsa header.b=pYnOFOL4; dkim=neutral (no key) header.i=@suse.cz; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 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 24F0810C6; Mon, 23 May 2022 02:44:23 -0700 (PDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233578AbiEWJoF (ORCPT + 99 others); Mon, 23 May 2022 05:44:05 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53760 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233725AbiEWJny (ORCPT ); Mon, 23 May 2022 05:43:54 -0400 Received: from smtp-out1.suse.de (smtp-out1.suse.de [195.135.220.28]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id EC229313A0; Mon, 23 May 2022 02:43:20 -0700 (PDT) Received: from relay2.suse.de (relay2.suse.de [149.44.160.134]) by smtp-out1.suse.de (Postfix) with ESMTP id 7A80A21A0C; Mon, 23 May 2022 09:43:19 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.cz; s=susede2_rsa; t=1653298999; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=3BKZ8QhniRBwgmI0twD/d6abArIatMrZ0L88M4PIxAY=; b=pYnOFOL4fLyk2ZVqao3ZZgJg88HHtAU5Qv0Y/xThaz6asCxFZxHy88Akh/JHtPd3i5DsD2 moB+iZm1ETqtKub8tv8JLxSAZorXFOC3SCealsTLwBChUNu6DIt5vDrLGJG4vy4KCldkSz NQ7bL5+4xzZiGgfj/dOsRbgzqgZKCv0= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.cz; s=susede2_ed25519; t=1653298999; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=3BKZ8QhniRBwgmI0twD/d6abArIatMrZ0L88M4PIxAY=; b=sYeUBH8Vq+NuReDcF+mK1TrSYs0jEqyG8X7UR4zhkDhWHyDOXTNOtwWKnMdeFbXj0vgRcs HzIQikTi1Cr78NAA== Received: from quack3.suse.cz (unknown [10.100.224.230]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by relay2.suse.de (Postfix) with ESMTPS id 58B142C141; Mon, 23 May 2022 09:43:19 +0000 (UTC) Received: by quack3.suse.cz (Postfix, from userid 1000) id 1094AA0632; Mon, 23 May 2022 11:43:18 +0200 (CEST) Date: Mon, 23 May 2022 11:43:18 +0200 From: Jan Kara To: Vasily Averin Cc: Jan Kara , kernel@openvz.org, linux-kernel@vger.kernel.org, Christoph Hellwig , Christian Brauner , Amir Goldstein , Matthew Bobrowski , linux-fsdevel@vger.kernel.org Subject: Re: [PATCH v3] fanotify: fix incorrect fmode_t casts Message-ID: <20220523094318.kyuuvbdl5mjuddgu@quack3.lan> References: <9adfd6ac-1b89-791e-796b-49ada3293985@openvz.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <9adfd6ac-1b89-791e-796b-49ada3293985@openvz.org> 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 On Sun 22-05-22 15:08:02, Vasily Averin wrote: > Fixes sparce warnings: > fs/notify/fanotify/fanotify_user.c:267:63: sparse: > warning: restricted fmode_t degrades to integer > fs/notify/fanotify/fanotify_user.c:1351:28: sparse: > warning: restricted fmode_t degrades to integer > > FMODE_NONTIFY have bitwise fmode_t type and requires __force attribute > for any casts. > > Signed-off-by: Vasily Averin > Reviewed-by: Christian Brauner (Microsoft) Thanks. I've merged the patch to my tree. Honza > --- > v3: split, according to Christoph Hellwig recommendation > --- > fs/notify/fanotify/fanotify_user.c | 4 ++-- > 1 file changed, 2 insertions(+), 2 deletions(-) > > diff --git a/fs/notify/fanotify/fanotify_user.c b/fs/notify/fanotify/fanotify_user.c > index a792e21c5309..16d8fc84713a 100644 > --- a/fs/notify/fanotify/fanotify_user.c > +++ b/fs/notify/fanotify/fanotify_user.c > @@ -264,7 +264,7 @@ static int create_fd(struct fsnotify_group *group, struct path *path, > * originally opened O_WRONLY. > */ > new_file = dentry_open(path, > - group->fanotify_data.f_flags | FMODE_NONOTIFY, > + group->fanotify_data.f_flags | __FMODE_NONOTIFY, > current_cred()); > if (IS_ERR(new_file)) { > /* > @@ -1348,7 +1348,7 @@ SYSCALL_DEFINE2(fanotify_init, unsigned int, flags, unsigned int, event_f_flags) > (!(fid_mode & FAN_REPORT_NAME) || !(fid_mode & FAN_REPORT_FID))) > return -EINVAL; > > - f_flags = O_RDWR | FMODE_NONOTIFY; > + f_flags = O_RDWR | __FMODE_NONOTIFY; > if (flags & FAN_CLOEXEC) > f_flags |= O_CLOEXEC; > if (flags & FAN_NONBLOCK) > -- > 2.36.1 > -- Jan Kara SUSE Labs, CR