aboutsummaryrefslogtreecommitdiffstats
path: root/net/core
diff options
context:
space:
mode:
authorKay Sievers <kay.sievers@vrfy.org>2007-08-14 09:15:12 -0400
committerGreg Kroah-Hartman <gregkh@suse.de>2007-10-12 17:51:01 -0400
commit7eff2e7a8b65c25920207324e56611150eb1cd9a (patch)
tree02a0eeba9d25d996233e30c18f258dfae0ae2139 /net/core
parent8380770c842faef3001e44662953d64ad9a93663 (diff)
Driver core: change add_uevent_var to use a struct
This changes the uevent buffer functions to use a struct instead of a long list of parameters. It does no longer require the caller to do the proper buffer termination and size accounting, which is currently wrong in some places. It fixes a known bug where parts of the uevent environment are overwritten because of wrong index calculations. Many thanks to Mathieu Desnoyers for finding bugs and improving the error handling. Signed-off-by: Kay Sievers <kay.sievers@vrfy.org> Cc: Mathieu Desnoyers <mathieu.desnoyers@polymtl.ca> Cc: Cornelia Huck <cornelia.huck@de.ibm.com> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Diffstat (limited to 'net/core')
-rw-r--r--net/core/net-sysfs.c14
1 files changed, 4 insertions, 10 deletions
diff --git a/net/core/net-sysfs.c b/net/core/net-sysfs.c
index 909a03d6c0e..6628e457ddc 100644
--- a/net/core/net-sysfs.c
+++ b/net/core/net-sysfs.c
@@ -396,28 +396,22 @@ static struct attribute_group wireless_group = {
396#endif /* CONFIG_SYSFS */ 396#endif /* CONFIG_SYSFS */
397 397
398#ifdef CONFIG_HOTPLUG 398#ifdef CONFIG_HOTPLUG
399static int netdev_uevent(struct device *d, char **envp, 399static int netdev_uevent(struct device *d, struct kobj_uevent_env *env)
400 int num_envp, char *buf, int size)
401{ 400{
402 struct net_device *dev = to_net_dev(d); 401 struct net_device *dev = to_net_dev(d);
403 int retval, len = 0, i = 0; 402 int retval;
404 403
405 /* pass interface to uevent. */ 404 /* pass interface to uevent. */
406 retval = add_uevent_var(envp, num_envp, &i, 405 retval = add_uevent_var(env, "INTERFACE=%s", dev->name);
407 buf, size, &len,
408 "INTERFACE=%s", dev->name);
409 if (retval) 406 if (retval)
410 goto exit; 407 goto exit;
411 408
412 /* pass ifindex to uevent. 409 /* pass ifindex to uevent.
413 * ifindex is useful as it won't change (interface name may change) 410 * ifindex is useful as it won't change (interface name may change)
414 * and is what RtNetlink uses natively. */ 411 * and is what RtNetlink uses natively. */
415 retval = add_uevent_var(envp, num_envp, &i, 412 retval = add_uevent_var(env, "IFINDEX=%d", dev->ifindex);
416 buf, size, &len,
417 "IFINDEX=%d", dev->ifindex);
418 413
419exit: 414exit:
420 envp[i] = NULL;
421 return retval; 415 return retval;
422} 416}
423#endif 417#endif