From mboxrd@z Thu Jan 1 00:00:00 1970 From: Al Viro Subject: Re: Fixing fmode_t warnings Date: Tue, 18 Nov 2008 17:00:22 +0000 Message-ID: <20081118170022.GT28946@ZenIV.linux.org.uk> References: <524f69650811180841v135a3d15o702766c703b4be22@mail.gmail.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Cc: Dave Kleikamp , Jeff Layton , Shirish Pargaonkar , linux-fsdevel To: Steve French Return-path: Received: from zeniv.linux.org.uk ([195.92.253.2]:41009 "EHLO ZenIV.linux.org.uk" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754965AbYKRRA0 (ORCPT ); Tue, 18 Nov 2008 12:00:26 -0500 Content-Disposition: inline In-Reply-To: <524f69650811180841v135a3d15o702766c703b4be22@mail.gmail.com> Sender: linux-fsdevel-owner@vger.kernel.org List-ID: On Tue, Nov 18, 2008 at 10:41:17AM -0600, Steve French wrote: > Do you think it is worthwhile fixing this "sparse" warning ? oflags > is an int since the lookup intent open.flags is an int ... > > CHECK fs/cifs/dir.c > fs/cifs/dir.c:169:16: warning: restricted fmode_t degrades to integer > fs/cifs/dir.c:171:16: warning: restricted fmode_t degrades to integer > > int oflags = nd->intent.open.flags; > desiredAccess = 0; > (line 169) if (oflags & FMODE_READ) > desiredAccess |= GENERIC_READ; > (line 171) if (oflags & FMODE_WRITE) { It's worse than that; open.flags *mixes* FMODE_... with O_... The right solution is to get rid of the damn thing and pass struct file with pre-fill ->f_mode to (split-off) variant of create.