diff options
Diffstat (limited to 'net/core/net-sysfs.c')
-rw-r--r-- | net/core/net-sysfs.c | 28 |
1 files changed, 11 insertions, 17 deletions
diff --git a/net/core/net-sysfs.c b/net/core/net-sysfs.c index e441ec7988c1..b21307b15b82 100644 --- a/net/core/net-sysfs.c +++ b/net/core/net-sysfs.c | |||
@@ -412,31 +412,25 @@ static int netdev_uevent(struct device *d, char **envp, | |||
412 | int num_envp, char *buf, int size) | 412 | int num_envp, char *buf, int size) |
413 | { | 413 | { |
414 | struct net_device *dev = to_net_dev(d); | 414 | struct net_device *dev = to_net_dev(d); |
415 | int i = 0; | 415 | int retval, len = 0, i = 0; |
416 | int n; | ||
417 | 416 | ||
418 | /* pass interface to uevent. */ | 417 | /* pass interface to uevent. */ |
419 | envp[i++] = buf; | 418 | retval = add_uevent_var(envp, num_envp, &i, |
420 | n = snprintf(buf, size, "INTERFACE=%s", dev->name) + 1; | 419 | buf, size, &len, |
421 | buf += n; | 420 | "INTERFACE=%s", dev->name); |
422 | size -= n; | 421 | if (retval) |
423 | 422 | goto exit; | |
424 | if ((size <= 0) || (i >= num_envp)) | ||
425 | return -ENOMEM; | ||
426 | 423 | ||
427 | /* pass ifindex to uevent. | 424 | /* pass ifindex to uevent. |
428 | * ifindex is useful as it won't change (interface name may change) | 425 | * ifindex is useful as it won't change (interface name may change) |
429 | * and is what RtNetlink uses natively. */ | 426 | * and is what RtNetlink uses natively. */ |
430 | envp[i++] = buf; | 427 | retval = add_uevent_var(envp, num_envp, &i, |
431 | n = snprintf(buf, size, "IFINDEX=%d", dev->ifindex) + 1; | 428 | buf, size, &len, |
432 | buf += n; | 429 | "IFINDEX=%d", dev->ifindex); |
433 | size -= n; | ||
434 | |||
435 | if ((size <= 0) || (i >= num_envp)) | ||
436 | return -ENOMEM; | ||
437 | 430 | ||
431 | exit: | ||
438 | envp[i] = NULL; | 432 | envp[i] = NULL; |
439 | return 0; | 433 | return retval; |
440 | } | 434 | } |
441 | #endif | 435 | #endif |
442 | 436 | ||