Re: [PATCH][1/2] [RESEND] kobject: add HOTPLUG_ENV_VAR

From: Roland Dreier
Date: Tue Sep 28 2004 - 10:31:25 EST


Your patch is buggy:

+ length += snprintf (buffer + length, max(buffer_size - length, 0),
"DEVICE=/proc/bus/usb/%03d/%03d",
usb_dev->bus->busnum, usb_dev->devnum);

snprintf() returns the number of characters that would be written not
counting the trailing NUL. So the next env var is going to be
concatenated with this one.

It's precisely this sort of easy-to-make off-by-one bug that convinces
me the hotplug environment variable handling needs to be wrapped up in
a helper macro or function.

Thanks,
Roland
-
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/