lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:	Wed, 11 Aug 2010 15:05:15 +0100
From:	Al Viro <viro@...IV.linux.org.uk>
To:	Davidlohr Bueso <dave@....org>
Cc:	LKML <linux-kernel@...r.kernel.org>, kay.sievers@...y.org,
	gregkh@...e.de
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@....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.
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ