aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/netconsole.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/net/netconsole.c')
-rw-r--r--drivers/net/netconsole.c20
1 files changed, 4 insertions, 16 deletions
diff --git a/drivers/net/netconsole.c b/drivers/net/netconsole.c
index 62fdbaa1fb60..a83e101440fd 100644
--- a/drivers/net/netconsole.c
+++ b/drivers/net/netconsole.c
@@ -429,8 +429,6 @@ static ssize_t store_remote_mac(struct netconsole_target *nt,
429 size_t count) 429 size_t count)
430{ 430{
431 u8 remote_mac[ETH_ALEN]; 431 u8 remote_mac[ETH_ALEN];
432 char *p = (char *) buf;
433 int i;
434 432
435 if (nt->enabled) { 433 if (nt->enabled) {
436 printk(KERN_ERR "netconsole: target (%s) is enabled, " 434 printk(KERN_ERR "netconsole: target (%s) is enabled, "
@@ -439,23 +437,13 @@ static ssize_t store_remote_mac(struct netconsole_target *nt,
439 return -EINVAL; 437 return -EINVAL;
440 } 438 }
441 439
442 for (i = 0; i < ETH_ALEN - 1; i++) { 440 if (!mac_pton(buf, remote_mac))
443 remote_mac[i] = simple_strtoul(p, &p, 16); 441 return -EINVAL;
444 if (*p != ':') 442 if (buf[3 * ETH_ALEN - 1] && buf[3 * ETH_ALEN - 1] != '\n')
445 goto invalid; 443 return -EINVAL;
446 p++;
447 }
448 remote_mac[ETH_ALEN - 1] = simple_strtoul(p, &p, 16);
449 if (*p && (*p != '\n'))
450 goto invalid;
451
452 memcpy(nt->np.remote_mac, remote_mac, ETH_ALEN); 444 memcpy(nt->np.remote_mac, remote_mac, ETH_ALEN);
453 445
454 return strnlen(buf, count); 446 return strnlen(buf, count);
455
456invalid:
457 printk(KERN_ERR "netconsole: invalid input\n");
458 return -EINVAL;
459} 447}
460 448
461/* 449/*