[lkml]   [2010]   [Jan]   [25]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
Messages in this thread
SubjectRe: sysfs_ops show vector: size of buffer not required?
On Sun, Jan 24, 2010 at 01:11:18PM +0530, Himanshu Chauhan wrote:
> Hi All,
> The sysfs_ops's show vector doesn't have a size of the
> buffer given to the vector, while store on the other hand
> has. What is the rationale behind it?

If you need to check the size, you are doing something wrong.

Seriously, that is the reason. A sysfs file should be a single value,
which will never overflow the buffer.

> I see most of the implementations doing strcpy in the
> show vectors. Ill behaved driver might overwrite the
> given buffer when size is not known. Should this be addressed
> by providing the buffer size along with the buffer pointer?


Again, a single value only, it easily fits into the buffer size.


greg k-h

 \ /
  Last update: 2010-01-26 05:49    [W:0.055 / U:3.172 seconds]
©2003-2018 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site