mirror of
https://github.com/adulau/aha.git
synced 2024-12-28 11:46:19 +00:00
netconsole: avoid null pointer dereference at show_local_mac()
This patch avoids a null pointer dereference when we read local_mac for netconsole in configfs and shows default local mac address value. A null pointer dereference occurs when we call show_local_mac() via local_mac entry in configfs before we setup the content of netpoll using netpoll_setup(). Signed-off-by: Keiichi KII <k-keiichi@bx.jp.nec.com> Signed-off-by: David S. Miller <davem@davemloft.net>
This commit is contained in:
parent
b5c15fc004
commit
69c3683ca7
1 changed files with 2 additions and 2 deletions
|
@ -309,8 +309,8 @@ static ssize_t show_local_mac(struct netconsole_target *nt, char *buf)
|
|||
struct net_device *dev = nt->np.dev;
|
||||
|
||||
DECLARE_MAC_BUF(mac);
|
||||
return snprintf(buf, PAGE_SIZE, "%s\n",
|
||||
print_mac(mac, dev->dev_addr));
|
||||
return snprintf(buf, PAGE_SIZE, "%s\n", dev ?
|
||||
print_mac(mac, dev->dev_addr) : "ff:ff:ff:ff:ff:ff");
|
||||
}
|
||||
|
||||
static ssize_t show_remote_mac(struct netconsole_target *nt, char *buf)
|
||||
|
|
Loading…
Reference in a new issue