On Tue, Jan 26, 2021 at 11:07:24PM +0530, Mohana Datta Yelugoti wrote: > Hello everyone, > > I am going through Documentation/filesystems/sysfs.rst. > > It says that sysfs allocates a buffer of size PAGE_SIZE and > passes it to the show/store functions of the attribute. On > read(), the show() method should fill the entire buffer[0]. No, that's not the case. Please only fill in what you need sent back to userspace and return the number of bytes you used. A simple call to sprintf() or better yet, sysfs_emit(), as a return statement is all you need to do. See the thousands of examples in the kernel of this if you need proof :) thanks, greg k-h _______________________________________________ Kernelnewbies mailing list Kernelnewbies@xxxxxxxxxxxxxxxxx https://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies