Skip to contentSkip to conversation

commit 45cd8d8e -- why?

DISCUSSION Roland Dreier 3 participants 3 messages Apr 28, 2007

lore
Share & tools
lore
#0 lore raw

The changelog says:

fs/sysfs/bin.c: In function 'read':
fs/sysfs/bin.c:77: warning: format '%zd' expects type 'signed size_t', but argument 4 has type 'int'

but the signature of the function read() is

read(struct file * file, char __user * userbuf, size_t count, loff_t * off)

and git blame seems to show it was always thus -- ie count was always size_t.

And now on x86-64 and ia64 with gcc 4.1 at least, I get:

fs/sysfs/bin.c: In function 'read':
fs/sysfs/bin.c:62: warning: format '%d' expects type 'int', but argument 4 has type 'size_t'

Andrew, what compiler were you using to get that warning? Should we revert commit 45cd8d8e?

- R.

#1 lore raw
Quoted 7 lines · On Fri, 27 Apr 2007 19:50:19 -0700 Roland Dreier <[email protected]> wrote:

The changelog says:

fs/sysfs/bin.c: In function 'read':
fs/sysfs/bin.c:77: warning: format '%zd' expects type 'signed size_t', but argument 4 has type 'int'

but the signature of the function read() is

Quoted 8 lines

read(struct file * file, char __user * userbuf, size_t count, loff_t * off)

and git blame seems to show it was always thus -- ie count was always size_t.

And now on x86-64 and ia64 with gcc 4.1 at least, I get:

fs/sysfs/bin.c: In function 'read':
fs/sysfs/bin.c:62: warning: format '%d' expects type 'int', but argument 4 has type 'size_t'

Some patches landed out of order. In Greg's tree (with Tejun's patches) count' is a local variable (not an incoming arg) of type int'.

So this patch was against Tejun's stuff, not against mainline.

I'd have picked that up, but I went and assumed that it was a victim of the new dev_dbg() printk arg checking stuff. Ho hum.

#2 lore raw
Quoted 18 lines · Andrew Morton
Quoted 7 lines · On Fri, 27 Apr 2007 19:50:19 -0700 Roland Dreier <[email protected]> wrote:

The changelog says:

fs/sysfs/bin.c: In function 'read':
fs/sysfs/bin.c:77: warning: format '%zd' expects type 'signed size_t', but argument 4 has type 'int'

but the signature of the function read() is

Quoted 8 lines

read(struct file * file, char __user * userbuf, size_t count, loff_t * off)

and git blame seems to show it was always thus -- ie count was always size_t.

And now on x86-64 and ia64 with gcc 4.1 at least, I get:

fs/sysfs/bin.c: In function 'read':
fs/sysfs/bin.c:62: warning: format '%d' expects type 'int', but argument 4 has type 'size_t'

Quoted 7 lines

Some patches landed out of order. In Greg's tree (with Tejun's patches) count' is a local variable (not an incoming arg) of type int'.

So this patch was against Tejun's stuff, not against mainline.

I'd have picked that up, but I went and assumed that it was a victim of the new dev_dbg() printk arg checking stuff. Ho hum.

Ah.. I already have this fix merged in my patch series. I'm currently testing things, so please be patient a little bit more. Thanks.

Signature · 1 line
tejun