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 for Android: free password hash cracker in your pocket
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:	Tue, 24 Aug 2010 17:35:43 -0700
From:	Joe Perches <joe@...ches.com>
To:	Changli Gao <xiaosuo@...il.com>
Cc:	akpm@...ux-foundation.org, linux-kernel@...r.kernel.org
Subject: Re: [PATCH] lib: fix scnprintf() if @size is == 0

On Wed, 2010-08-25 at 08:10 +0800, Changli Gao wrote:
> On Wed, Aug 25, 2010 at 8:03 AM, Joe Perches <joe@...ches.com> wrote:
> > Isn't simpler to check size at the beginning of the function?
> It is a rare case, so don't slow down the normal users.

That's fine, but I don't like blinking that much
when I read code.

How about:

	if (i < size)
		return i;
	if (size)
		return i - 1;
	return 0;

--
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