aboutsummaryrefslogtreecommitdiffstats
path: root/net/atm/atm_sysfs.c
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/atm/atm_sysfs.c
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/atm/atm_sysfs.c')
-rw-r--r--net/atm/atm_sysfs.c7
1 files changed, 2 insertions, 5 deletions
diff --git a/net/atm/atm_sysfs.c b/net/atm/atm_sysfs.c
index f094a0879c16..9ef07eda2c43 100644
--- a/net/atm/atm_sysfs.c
+++ b/net/atm/atm_sysfs.c
@@ -105,10 +105,9 @@ static struct class_device_attribute *atm_attrs[] = {
105 NULL 105 NULL
106}; 106};
107 107
108static int atm_uevent(struct class_device *cdev, char **envp, int num_envp, char *buf, int size) 108static int atm_uevent(struct class_device *cdev, struct kobj_uevent_env *env)
109{ 109{
110 struct atm_dev *adev; 110 struct atm_dev *adev;
111 int i = 0, len = 0;
112 111
113 if (!cdev) 112 if (!cdev)
114 return -ENODEV; 113 return -ENODEV;
@@ -117,11 +116,9 @@ static int atm_uevent(struct class_device *cdev, char **envp, int num_envp, char
117 if (!adev) 116 if (!adev)
118 return -ENODEV; 117 return -ENODEV;
119 118
120 if (add_uevent_var(envp, num_envp, &i, buf, size, &len, 119 if (add_uevent_var(env, "NAME=%s%d", adev->type, adev->number))
121 "NAME=%s%d", adev->type, adev->number))
122 return -ENOMEM; 120 return -ENOMEM;
123 121
124 envp[i] = NULL;
125 return 0; 122 return 0;
126} 123}
127 124