Messages in this thread | | | From | Roland Dreier <> | Date | Tue, 28 Sep 2004 08:29:39 -0700 | Subject | Re: [PATCH][1/2] [RESEND] kobject: add HOTPLUG_ENV_VAR |
| |
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@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
| |