memory waste in fs/devices.c/kdevname()

Tigran Aivazian (tigran@aivazian.demon.co.uk)
Fri, 18 Dec 1998 12:41:12 +0000 (GMT)


Hi,

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

And, btw, kdevname() does not seem to be declared anywhere although
many things use it. Why not stick it in <linux/fs.h> ?

Regards,
Tigran.

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