From c61b666e260d5cc2e0203b21c689321e6ab0d676 Mon Sep 17 00:00:00 2001 From: Allan Stephens Date: Fri, 7 Oct 2011 11:31:49 -0400 Subject: tipc: Improve handling of media address printing errors Enhances conversion of a media address to printable form so that an unconvertable address will be displayed as a string of hex digits, rather than not being displayed at all. (Also removes a pointless check for the existence of the media-specific address conversion routine, since the routine is not optional.) Signed-off-by: Allan Stephens Signed-off-by: Paul Gortmaker --- net/tipc/eth_media.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) (limited to 'net/tipc/eth_media.c') diff --git a/net/tipc/eth_media.c b/net/tipc/eth_media.c index 15c685b868db..67f616aa5dbb 100644 --- a/net/tipc/eth_media.c +++ b/net/tipc/eth_media.c @@ -243,15 +243,15 @@ static int recv_notification(struct notifier_block *nb, unsigned long evt, * eth_addr2str - convert Ethernet address to string */ -static char *eth_addr2str(struct tipc_media_addr *a, char *str_buf, int str_size) +static int eth_addr2str(struct tipc_media_addr *a, char *str_buf, int str_size) { unchar *addr = (unchar *)&a->dev_addr; - if (str_size < 18) - *str_buf = '\0'; - else - sprintf(str_buf, "%pM", addr); - return str_buf; + if (str_size < 18) /* 18 = strlen("aa:bb:cc:dd:ee:ff\0") */ + return 1; + + sprintf(str_buf, "%pM", addr); + return 0; } /* -- cgit v1.2.3