lkml.org 
[lkml]   [1998]   [Dec]   [18]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: memory waste in fs/devices.c/kdevname()
On Fri, Dec 18, 1998 at 12:41:12PM +0000, Tigran Aivazian wrote:
> The current (2.1.131) code is:
>
> char * kdevname(kdev_t dev)
> {
> static char buffer[32];
> sprintf(buffer, "%02x:%02x", MAJOR(dev), MINOR(dev));
> return buffer;
> }
>
> But the maximum length of "%02x:%02x" is 6 bytes (including '\0').
> We can throw in a couple of bytes "for good measure" and have
> static char buffer[8] but why on earth do we declare it as [32]?

You're right. Better change it to [42] ready for 64-bit major & minor
numbers...

-- Jamie

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.rutgers.edu
Please read the FAQ at http://www.tux.org/lkml/

\
 
 \ /
  Last update: 2005-03-22 13:46    [W:0.042 / U:0.016 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site