Re: PATCH -- kobject_set_name() doesn't allocate enough space

From: Linus Torvalds
Date: Tue Dec 16 2003 - 15:45:04 EST




On Tue, 16 Dec 2003, Linda Xie wrote:
>
> The sapce allocated in kobject_set_name() is 1 byte less than it should
> be. The Attached patch fixes this bug.

Good catch - it _should_ mean that long names always had the last byte cut
off. Why didn't anybody notice? Are people just not using long names?

> Comments are welcome.

The patch looks correct, but you should change the last test to be
appropriate too, ie the

/* Still? Give up. */
if (need > limit) {

test should, as far as I can tell, be

if (need >= limit) {

instead.

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