lkml.org 
[lkml]   [2012]   [Jul]   [18]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH] SUNRPC: Prevent kernel stack corruption on long values of flush
Dave Jones wrote:

On Wed, Jul 18, 2012 at 04:00:49PM -0400, Jim Rees wrote:

> You could use something like:
>
> char tbuf[sizeof (unsigned long) * 24 / 10 + 1 + 2]; /* + 2 for final "\n\0" */
>
> since there are roughly 10 bits for every 3 decimal digits.
>
> But I'm obviously confused, because I don't understand why tbuf needs to be
> any more than 10 + 2.

Unsigned long isn't necessarily 32 bits.
On 64-bit systems %lu can be up to 18446744073709551615

Thanks. You caught me thinking "Intel." How embarrassing.


\
 
 \ /
  Last update: 2012-07-18 23:41    [W:0.076 / U:0.268 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site