Subject: Re: [patch v3] PS3: Fix printing of os-area magic numbers

From: Geoff Levand <[email-masked]>
Date: Sun, 23 Dec 2007 09:20:15 -0800

On 12/23/2007 01:51 AM, Geert Uytterhoeven wrote:
> On Sat, 22 Dec 2007, Geoff Levand wrote:
>> +static void dump_field(char *s, const u8 *f, unsigned int size)
>> +{
>> +#if defined(DEBUG)
>> +	unsigned int i;
>> +
>> +	for (i = 0; i < size; i++)
>> +		s[i] = isprint(f[i]) ? f[i] : '.';
>> +	s[i] = 0;
>> +#endif
>> +}
> 
> Sorry for nitpicking again.
> 
> Usually the _length_ of a C-string is the number of characters, while the
> _size_ of a C-string includes the zero-terminator.
> 
> In dump_field() it writes size+1 bytes to s.

The arg size is the size of the field in bytes:

  dump_field(str, h->magic_num, sizeof(h->magic_num));

To me, the name length doesn't seem to convey that.

-Geoff