lkml.org 
[lkml]   [2004]   [Sep]   [28]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
From
Date
SubjectRe: [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/

\
 
 \ /
  Last update: 2005-03-22 14:06    [W:0.110 / U:0.544 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site