linux-fsdevel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* New sparse warning on setting s_maxbytes?
@ 2012-10-03 19:07 Steve French
  2012-10-03 19:49 ` Jeff Layton
  0 siblings, 1 reply; 4+ messages in thread
From: Steve French @ 2012-10-03 19:07 UTC (permalink / raw)
  To: linux-fsdevel

I noticed this new sparse warning on setting s_maxbytes
fs/cifs/cifsfs.c:109:34: warning: constant 0x7fffffffffffffff is so
big it is long

e.g. cifsfs.c, as do various other file systems, has

            sb->s_maxbytes = MAX_LFS_FILESIZE;

fs.h defines it:

/* Page cache limit. The filesystems should put that into their s_maxbytes
   limits, otherwise bad things can happen in VM. */
#if BITS_PER_LONG==32
#define MAX_LFS_FILESIZE	(((loff_t)PAGE_CACHE_SIZE << (BITS_PER_LONG-1))-1)
#elif BITS_PER_LONG==64
#define MAX_LFS_FILESIZE 	((loff_t)0x7fffffffffffffff)
#endif

It looks like recent commit 2bd2c1941f141ad780135ccc1cd08ca71a24f10a
("MAX_LFS_FILESIZE should be a loff_t") causes the warning.  Removes
one warning but causes another.

-- 
Thanks,

Steve

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: New sparse warning on setting s_maxbytes?
  2012-10-03 19:07 New sparse warning on setting s_maxbytes? Steve French
@ 2012-10-03 19:49 ` Jeff Layton
  2012-10-03 19:52   ` Al Viro
  0 siblings, 1 reply; 4+ messages in thread
From: Jeff Layton @ 2012-10-03 19:49 UTC (permalink / raw)
  To: Steve French; +Cc: linux-fsdevel

On Wed, 3 Oct 2012 14:07:55 -0500
Steve French <smfrench@gmail.com> wrote:

> I noticed this new sparse warning on setting s_maxbytes
> fs/cifs/cifsfs.c:109:34: warning: constant 0x7fffffffffffffff is so
> big it is long
> 
> e.g. cifsfs.c, as do various other file systems, has
> 
>             sb->s_maxbytes = MAX_LFS_FILESIZE;
> 
> fs.h defines it:
> 
> /* Page cache limit. The filesystems should put that into their s_maxbytes
>    limits, otherwise bad things can happen in VM. */
> #if BITS_PER_LONG==32
> #define MAX_LFS_FILESIZE	(((loff_t)PAGE_CACHE_SIZE << (BITS_PER_LONG-1))-1)
> #elif BITS_PER_LONG==64
> #define MAX_LFS_FILESIZE 	((loff_t)0x7fffffffffffffff)
> #endif
> 
> It looks like recent commit 2bd2c1941f141ad780135ccc1cd08ca71a24f10a
> ("MAX_LFS_FILESIZE should be a loff_t") causes the warning.  Removes
> one warning but causes another.
> 

That sounds like a sparse bug. loff_t is a "long long" AFAICT, which
should be fine to hold that large a value...

-- 
Jeff Layton <jlayton@redhat.com>

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: New sparse warning on setting s_maxbytes?
  2012-10-03 19:49 ` Jeff Layton
@ 2012-10-03 19:52   ` Al Viro
  2012-10-03 20:08     ` Steve French
  0 siblings, 1 reply; 4+ messages in thread
From: Al Viro @ 2012-10-03 19:52 UTC (permalink / raw)
  To: Jeff Layton; +Cc: Steve French, linux-fsdevel

On Wed, Oct 03, 2012 at 03:49:59PM -0400, Jeff Layton wrote:
> On Wed, 3 Oct 2012 14:07:55 -0500
> Steve French <smfrench@gmail.com> wrote:
> 
> > I noticed this new sparse warning on setting s_maxbytes
> > fs/cifs/cifsfs.c:109:34: warning: constant 0x7fffffffffffffff is so
> > big it is long
> > 
> > e.g. cifsfs.c, as do various other file systems, has
> > 
> >             sb->s_maxbytes = MAX_LFS_FILESIZE;
> > 
> > fs.h defines it:
> > 
> > /* Page cache limit. The filesystems should put that into their s_maxbytes
> >    limits, otherwise bad things can happen in VM. */
> > #if BITS_PER_LONG==32
> > #define MAX_LFS_FILESIZE	(((loff_t)PAGE_CACHE_SIZE << (BITS_PER_LONG-1))-1)
> > #elif BITS_PER_LONG==64
> > #define MAX_LFS_FILESIZE 	((loff_t)0x7fffffffffffffff)
> > #endif
> > 
> > It looks like recent commit 2bd2c1941f141ad780135ccc1cd08ca71a24f10a
> > ("MAX_LFS_FILESIZE should be a loff_t") causes the warning.  Removes
> > one warning but causes another.
> > 
> 
> That sounds like a sparse bug. loff_t is a "long long" AFAICT, which
> should be fine to hold that large a value...

Not really - potentially it's a portability problem.  I'll slap LL suffix
there, to make things explicit.  Will be in the next vfs.git pull request...

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: New sparse warning on setting s_maxbytes?
  2012-10-03 19:52   ` Al Viro
@ 2012-10-03 20:08     ` Steve French
  0 siblings, 0 replies; 4+ messages in thread
From: Steve French @ 2012-10-03 20:08 UTC (permalink / raw)
  To: Al Viro; +Cc: Jeff Layton, linux-fsdevel

On Wed, Oct 3, 2012 at 2:52 PM, Al Viro <viro@zeniv.linux.org.uk> wrote:
> On Wed, Oct 03, 2012 at 03:49:59PM -0400, Jeff Layton wrote:
>> On Wed, 3 Oct 2012 14:07:55 -0500
>> Steve French <smfrench@gmail.com> wrote:
>>
>> > I noticed this new sparse warning on setting s_maxbytes
>> > fs/cifs/cifsfs.c:109:34: warning: constant 0x7fffffffffffffff is so
>> > big it is long
>> >
>> > e.g. cifsfs.c, as do various other file systems, has
>> >
>> >             sb->s_maxbytes = MAX_LFS_FILESIZE;
>> >
>> > fs.h defines it:
>> >
>> > /* Page cache limit. The filesystems should put that into their s_maxbytes
>> >    limits, otherwise bad things can happen in VM. */
>> > #if BITS_PER_LONG==32
>> > #define MAX_LFS_FILESIZE    (((loff_t)PAGE_CACHE_SIZE << (BITS_PER_LONG-1))-1)
>> > #elif BITS_PER_LONG==64
>> > #define MAX_LFS_FILESIZE    ((loff_t)0x7fffffffffffffff)
>> > #endif
>> >
>> > It looks like recent commit 2bd2c1941f141ad780135ccc1cd08ca71a24f10a
>> > ("MAX_LFS_FILESIZE should be a loff_t") causes the warning.  Removes
>> > one warning but causes another.
>> >
>>
>> That sounds like a sparse bug. loff_t is a "long long" AFAICT, which
>> should be fine to hold that large a value...
>
> Not really - potentially it's a portability problem.  I'll slap LL suffix
> there, to make things explicit.  Will be in the next vfs.git pull request...

Makes sense. Thanks

-- 
Thanks,

Steve

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2012-10-03 20:08 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-10-03 19:07 New sparse warning on setting s_maxbytes? Steve French
2012-10-03 19:49 ` Jeff Layton
2012-10-03 19:52   ` Al Viro
2012-10-03 20:08     ` Steve French

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).