From mboxrd@z Thu Jan 1 00:00:00 1970 From: Jeff Layton Subject: Re: Fixing fmode_t warnings Date: Tue, 18 Nov 2008 12:03:02 -0500 Message-ID: <20081118120302.7b08bacf@tleilax.poochiereds.net> References: <524f69650811180841v135a3d15o702766c703b4be22@mail.gmail.com> Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Cc: "Dave Kleikamp" , "Shirish Pargaonkar" , linux-fsdevel To: "Steve French" Return-path: Received: from mx2.redhat.com ([66.187.237.31]:44094 "EHLO mx2.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752827AbYKRRDR (ORCPT ); Tue, 18 Nov 2008 12:03:17 -0500 In-Reply-To: <524f69650811180841v135a3d15o702766c703b4be22@mail.gmail.com> Sender: linux-fsdevel-owner@vger.kernel.org List-ID: On Tue, 18 Nov 2008 10:41:17 -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) { > > In general, I'm for fixing most warnings unless there is a good reason not to. When things compile and checkers run cleanly it can really help you to detect bugs... My suggestion would be to go ahead and make oflags a fmode_t and just cast the intent.open.flags to fmode_t. -- Jeff Layton