Messages in this thread | | | Date | Wed, 11 Aug 2010 15:05:15 +0100 | From | Al Viro <> | Subject | Re: [PATCH] kernel/ksysfs: use snprintf for sysfs show |
| |
On Wed, Aug 11, 2010 at 09:44:10AM -0400, Davidlohr Bueso wrote: > Use snprintf(buf, PAGE_SIZE, ...) instead of sprintf for sysfs show > methods. This is suggested in Documentation/filesystems/sysfs.txt
... therefore it must be done, the common sense be damned.
> Signed-off-by: Davidlohr Bueso <dave@gnu.org> > ---
> static ssize_t uevent_seqnum_show(struct kobject *kobj, > struct kobj_attribute *attr, char *buf) > { > - return sprintf(buf, "%llu\n", (unsigned long long)uevent_seqnum); > + return snprintf(buf, PAGE_SIZE, "%llu\n", > + (unsigned long long)uevent_seqnum);
A-yup - that's an improvement, all right, on them evil boxen that got long long so huge that its decimal representation won't fit into a page.
NAK. Cargo-cult programming is bad.
| |