Received: by 2002:a05:6358:53a8:b0:117:f937:c515 with SMTP id z40csp348116rwe; Fri, 14 Apr 2023 03:58:48 -0700 (PDT) X-Google-Smtp-Source: AKy350Z81IapEBKuF8eveMN7Y57Adad7fec4yUoBiIVaN3x3C8PfoyTRvPAShls1HcT1oUI32u/h X-Received: by 2002:a05:6a00:1a93:b0:638:d5a7:acc6 with SMTP id e19-20020a056a001a9300b00638d5a7acc6mr8204167pfv.9.1681469928236; Fri, 14 Apr 2023 03:58:48 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1681469928; cv=none; d=google.com; s=arc-20160816; b=JqBW1n3dAnHjsk7B6ekkJUupQTIkNmF8PEgs1Va+JMejsQ7PSFY3UVrNxin/cIHeC0 WqMdnL2jBYWnYSdalXawpDUt5R0nqTJ/nktJOibe11g3UBOVjIHK6BaabKxgrD+xnlEo p2fI5n8LpPPxKR77jluDG+sVDTJnPbM9501Ha1SE/mqx0NnJ4Mw5ejaIaLpOujQ8WuLp Yqv5Bnz5qILnCXep+yEbEKxRTUzmu1ZHKzJd/QSUnNPPB9dEsskznV3wbrBAH8YVBbkj 23fJQ9wk0ZLtuejHv2eVh0O9I2n0g6dJfgdDwcEiWoN5rtJAOdvu6lWO1U6wjoCvrsZI KNug== 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=NaDKrVzHktRGkhvNC8mOy7GLmS2NFDSAPBln7UTiz9Q=; b=Xo3GpCg2dlStFlHEf8VgoncDIz52+gL1T021qOShFqYnB+0QmYaypspSr/nuhznAcZ z5TUaWwBdK7aRpk4+7jVdSkoy+c7aSikqLT0aZbcJsXBuMOhBihdabvGPECyK+1oW6lc MbAWzRfQjoh/vVUrfdwogzQ9xk3DLnifL5Tz3EYZ0d577Hl57DUv9rL4igoywpRU31bg iF3ehLpUeUEBTYGUsQ1RJj1RnNBuQ0eYq7GEFRuoaif/A+ACI0rY+KlwPp+FOt0ip1l8 fmpD98Tjgo+g0ns1rzl1k2aGKPiaQNJOV0jnlKbO78/N335A1RZfuro2gqiDIxRAvfKy oUjA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@suse.cz header.s=susede2_rsa header.b=Mi9ou96w; 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:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id iw18-20020a170903045200b0019e6e61c1bcsi4171458plb.9.2023.04.14.03.58.33; Fri, 14 Apr 2023 03:58:48 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@suse.cz header.s=susede2_rsa header.b=Mi9ou96w; 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:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230095AbjDNKqb (ORCPT + 99 others); Fri, 14 Apr 2023 06:46:31 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52010 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229479AbjDNKq3 (ORCPT ); Fri, 14 Apr 2023 06:46:29 -0400 Received: from smtp-out2.suse.de (smtp-out2.suse.de [IPv6:2001:67c:2178:6::1d]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 3BC2895; Fri, 14 Apr 2023 03:46:27 -0700 (PDT) Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by smtp-out2.suse.de (Postfix) with ESMTPS id DD51E1FD95; Fri, 14 Apr 2023 10:46:25 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.cz; s=susede2_rsa; t=1681469185; 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=NaDKrVzHktRGkhvNC8mOy7GLmS2NFDSAPBln7UTiz9Q=; b=Mi9ou96w9xvxbp6Exkd6EGylmL5lp7Mu33FedVadh7SrkmmJPYwKGBSwr9zJxRKgFsdGb7 gHW0oGlD26djN5njEDeceOD4h9KXHxQfSrM6AgaOkZx0T9uJ+nQ3T2QvyTdd0PB26aCbvP X2ib6TA2fZs8xpSyoIDbx+IyyN2tXFw= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.cz; s=susede2_ed25519; t=1681469185; 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=NaDKrVzHktRGkhvNC8mOy7GLmS2NFDSAPBln7UTiz9Q=; b=9vWudS8M5XsxTuY0B046MKslysKF1mrmztRo4UGnWT4XH9akLQKLv9snoIat72AImT6d6c CRVVTnSwo1nRYXAw== Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by imap2.suse-dmz.suse.de (Postfix) with ESMTPS id CD957139FC; Fri, 14 Apr 2023 10:46:25 +0000 (UTC) Received: from dovecot-director2.suse.de ([192.168.254.65]) by imap2.suse-dmz.suse.de with ESMTPSA id zkolMgEvOWSNMgAAMHmgww (envelope-from ); Fri, 14 Apr 2023 10:46:25 +0000 Received: by quack3.suse.cz (Postfix, from userid 1000) id 4AD65A0732; Fri, 14 Apr 2023 12:46:25 +0200 (CEST) Date: Fri, 14 Apr 2023 12:46:25 +0200 From: Jan Kara To: Luca Vizzarro Cc: linux-kernel@vger.kernel.org, Kevin Brodsky , Szabolcs Nagy , Theodore Ts'o , David Laight , Mark Rutland , Alexander Viro , Christian Brauner , Jeff Layton , Chuck Lever , linux-fsdevel@vger.kernel.org, Jan Kara , Amir Goldstein Subject: Re: [PATCH 5/5] dnotify: Pass argument of fcntl_dirnotify as int Message-ID: <20230414104625.gyzuswldwil4jlfw@quack3> References: <20230414100212.766118-1-Luca.Vizzarro@arm.com> <20230414100212.766118-6-Luca.Vizzarro@arm.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20230414100212.766118-6-Luca.Vizzarro@arm.com> X-Spam-Status: No, score=-3.7 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_MED,SPF_HELO_NONE, SPF_SOFTFAIL,T_SCC_BODY_TEXT_LINE autolearn=ham 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 Fri 14-04-23 11:02:12, Luca Vizzarro wrote: > The interface for fcntl expects the argument passed for the command > F_DIRNOTIFY to be of type int. The current code wrongly treats it as > a long. In order to avoid access to undefined bits, we should explicitly > cast the argument to int. > > Cc: Kevin Brodsky > Cc: Szabolcs Nagy > Cc: "Theodore Ts'o" > Cc: David Laight > Cc: Mark Rutland > Cc: Alexander Viro > Cc: Christian Brauner > Cc: Jeff Layton > Cc: Chuck Lever > Cc: linux-fsdevel@vger.kernel.org > Cc: Jan Kara > Cc: Amir Goldstein > Signed-off-by: Luca Vizzarro Looks good to me. Do you plan to merge this series together (perhaps Christian could?) or should I pick up the dnotify patch? In case someone else will merge the patch feel free to add: Acked-by: Jan Kara Honza > --- > fs/notify/dnotify/dnotify.c | 4 ++-- > include/linux/dnotify.h | 4 ++-- > 2 files changed, 4 insertions(+), 4 deletions(-) > > diff --git a/fs/notify/dnotify/dnotify.c b/fs/notify/dnotify/dnotify.c > index 190aa717fa32..ebdcc25df0f7 100644 > --- a/fs/notify/dnotify/dnotify.c > +++ b/fs/notify/dnotify/dnotify.c > @@ -199,7 +199,7 @@ void dnotify_flush(struct file *filp, fl_owner_t id) > } > > /* this conversion is done only at watch creation */ > -static __u32 convert_arg(unsigned long arg) > +static __u32 convert_arg(unsigned int arg) > { > __u32 new_mask = FS_EVENT_ON_CHILD; > > @@ -258,7 +258,7 @@ static int attach_dn(struct dnotify_struct *dn, struct dnotify_mark *dn_mark, > * up here. Allocate both a mark for fsnotify to add and a dnotify_struct to be > * attached to the fsnotify_mark. > */ > -int fcntl_dirnotify(int fd, struct file *filp, unsigned long arg) > +int fcntl_dirnotify(int fd, struct file *filp, unsigned int arg) > { > struct dnotify_mark *new_dn_mark, *dn_mark; > struct fsnotify_mark *new_fsn_mark, *fsn_mark; > diff --git a/include/linux/dnotify.h b/include/linux/dnotify.h > index b1d26f9f1c9f..9f183a679277 100644 > --- a/include/linux/dnotify.h > +++ b/include/linux/dnotify.h > @@ -30,7 +30,7 @@ struct dnotify_struct { > FS_MOVED_FROM | FS_MOVED_TO) > > extern void dnotify_flush(struct file *, fl_owner_t); > -extern int fcntl_dirnotify(int, struct file *, unsigned long); > +extern int fcntl_dirnotify(int, struct file *, unsigned int); > > #else > > @@ -38,7 +38,7 @@ static inline void dnotify_flush(struct file *filp, fl_owner_t id) > { > } > > -static inline int fcntl_dirnotify(int fd, struct file *filp, unsigned long arg) > +static inline int fcntl_dirnotify(int fd, struct file *filp, unsigned int arg) > { > return -EINVAL; > } > -- > 2.34.1 > > IMPORTANT NOTICE: The contents of this email and any attachments are confidential and may also be privileged. If you are not the intended recipient, please notify the sender immediately and do not disclose the contents to any other person, use it for any purpose, or store or copy the information in any medium. Thank you. -- Jan Kara SUSE Labs, CR