Messages in this thread | | | Date | Fri, 18 Dec 1998 15:27:01 +0000 | From | Jamie Lokier <> | Subject | Re: 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/
| |