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:	Fri, 3 Aug 2012 11:51:13 +0200
From:	Kay Sievers <kay@...y.org>
To:	Nikunj A Dadhania <nikunj@...ux.vnet.ibm.com>
Cc:	Vikram Pandita <vikram.pandita@...com>, gregkh@...uxfoundation.org,
	linux-kernel@...r.kernel.org,
	Mike Turquette <mturquette@...aro.org>,
	Vimarsh Zutshi <vimarsh.zutshi@...il.com>
Subject: Re: [PATCH v2] printk: add option to print cpu id

On Fri, Aug 3, 2012 at 11:43 AM, Nikunj A Dadhania
<nikunj@...ux.vnet.ibm.com> wrote:
> On Fri, 3 Aug 2012 02:16:18 -0700, Vikram Pandita <vikram.pandita@...com> wrote:

>> +static size_t print_cpuid(u8 cpuid, char *buf)
>> +{
>> +
>> +     if (!printk_cpuid)
>> +             return 0;
>> +
>> +     if (!buf)
>> +             return 4;
>> +

> Firstly, why this magic number?
> Secondly, if buf is NULL, why should you increment?

The !buffer logic is used when we only calculate the size of the
output buffer, but do not print to it. It's just an optimization. And
yes, the number returned should match the number of chars that would
have been printed, so this does not look right.

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