Re: [PATCH driver-core-linus] sysfs: make sure read buffer is zeroed

2014-05-19 Thread Joe Perches
On Mon, 2014-05-19 at 20:49 -0400, Tejun Heo wrote: > On Mon, May 19, 2014 at 03:32:22PM -0700, Joe Perches wrote: > > > > + memset(buf, 0, PAGE_SIZE); > > > > memset(buf, 0, count)? > > It's always PAGE_SIZE. Outputs longer than that are truncated. Yeah, I know, but the code and

Re: [PATCH driver-core-linus] sysfs: make sure read buffer is zeroed

2014-05-19 Thread Tejun Heo
On Mon, May 19, 2014 at 03:32:22PM -0700, Joe Perches wrote: > > > + memset(buf, 0, PAGE_SIZE); > > memset(buf, 0, count)? It's always PAGE_SIZE. Outputs longer than that are truncated. Thanks. -- tejun -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the

Re: [PATCH driver-core-linus] sysfs: make sure read buffer is zeroed

2014-05-19 Thread Joe Perches
On Mon, 2014-05-19 at 15:25 -0700, Greg Kroah-Hartman wrote: > On Mon, May 19, 2014 at 03:52:10PM -0400, Tejun Heo wrote: > > 13c589d5b0ac ("sysfs: use seq_file when reading regular files") > > switched sysfs from custom read implementation to seq_file to enable > > later transition to kernfs.

Re: [PATCH driver-core-linus] sysfs: make sure read buffer is zeroed

2014-05-19 Thread Greg Kroah-Hartman
On Mon, May 19, 2014 at 03:52:10PM -0400, Tejun Heo wrote: > 13c589d5b0ac ("sysfs: use seq_file when reading regular files") > switched sysfs from custom read implementation to seq_file to enable > later transition to kernfs. After the change, the buffer passed to > ->show() is acquired through

[PATCH driver-core-linus] sysfs: make sure read buffer is zeroed

2014-05-19 Thread Tejun Heo
13c589d5b0ac ("sysfs: use seq_file when reading regular files") switched sysfs from custom read implementation to seq_file to enable later transition to kernfs. After the change, the buffer passed to ->show() is acquired through seq_get_buf(); unfortunately, this introduces a subtle behavior

Re: [PATCH driver-core-linus] sysfs: make sure read buffer is zeroed

2014-05-19 Thread Greg Kroah-Hartman
On Mon, May 19, 2014 at 03:52:10PM -0400, Tejun Heo wrote: 13c589d5b0ac (sysfs: use seq_file when reading regular files) switched sysfs from custom read implementation to seq_file to enable later transition to kernfs. After the change, the buffer passed to -show() is acquired through

Re: [PATCH driver-core-linus] sysfs: make sure read buffer is zeroed

2014-05-19 Thread Joe Perches
On Mon, 2014-05-19 at 15:25 -0700, Greg Kroah-Hartman wrote: On Mon, May 19, 2014 at 03:52:10PM -0400, Tejun Heo wrote: 13c589d5b0ac (sysfs: use seq_file when reading regular files) switched sysfs from custom read implementation to seq_file to enable later transition to kernfs. After the

Re: [PATCH driver-core-linus] sysfs: make sure read buffer is zeroed

2014-05-19 Thread Tejun Heo
On Mon, May 19, 2014 at 03:32:22PM -0700, Joe Perches wrote: + memset(buf, 0, PAGE_SIZE); memset(buf, 0, count)? It's always PAGE_SIZE. Outputs longer than that are truncated. Thanks. -- tejun -- To unsubscribe from this list: send the line unsubscribe linux-kernel in the body of

Re: [PATCH driver-core-linus] sysfs: make sure read buffer is zeroed

2014-05-19 Thread Joe Perches
On Mon, 2014-05-19 at 20:49 -0400, Tejun Heo wrote: On Mon, May 19, 2014 at 03:32:22PM -0700, Joe Perches wrote: + memset(buf, 0, PAGE_SIZE); memset(buf, 0, count)? It's always PAGE_SIZE. Outputs longer than that are truncated. Yeah, I know, but the code and comment above

[PATCH driver-core-linus] sysfs: make sure read buffer is zeroed

2014-05-19 Thread Tejun Heo
13c589d5b0ac (sysfs: use seq_file when reading regular files) switched sysfs from custom read implementation to seq_file to enable later transition to kernfs. After the change, the buffer passed to -show() is acquired through seq_get_buf(); unfortunately, this introduces a subtle behavior change.