Commit 6fc7f573 authored by Scott Feldman's avatar Scott Feldman Committed by David S. Miller

enic: bug fix: sprintf UUID to string as u8[] rather than u16[] array

Signed-off-by: default avatarScott Feldman <scofeldm@cisco.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 76cc8b13
...@@ -1034,9 +1034,10 @@ static int enic_set_port_profile(struct enic *enic, u8 request, u8 *mac, ...@@ -1034,9 +1034,10 @@ static int enic_set_port_profile(struct enic *enic, u8 request, u8 *mac,
{ {
struct vic_provinfo *vp; struct vic_provinfo *vp;
u8 oui[3] = VIC_PROVINFO_CISCO_OUI; u8 oui[3] = VIC_PROVINFO_CISCO_OUI;
unsigned short *uuid; u8 *uuid;
char uuid_str[38]; char uuid_str[38];
static char *uuid_fmt = "%04X%04X-%04X-%04X-%04X-%04X%04X%04X"; static char *uuid_fmt = "%02X%02X%02X%02X-%02X%02X-%02X%02X-"
"%02X%02X-%02X%02X%02X%02X%0X%02X";
int err; int err;
if (!name) if (!name)
...@@ -1058,20 +1059,24 @@ static int enic_set_port_profile(struct enic *enic, u8 request, u8 *mac, ...@@ -1058,20 +1059,24 @@ static int enic_set_port_profile(struct enic *enic, u8 request, u8 *mac,
ETH_ALEN, mac); ETH_ALEN, mac);
if (instance_uuid) { if (instance_uuid) {
uuid = (unsigned short *)instance_uuid; uuid = instance_uuid;
sprintf(uuid_str, uuid_fmt, sprintf(uuid_str, uuid_fmt,
uuid[0], uuid[1], uuid[2], uuid[3], uuid[0], uuid[1], uuid[2], uuid[3],
uuid[4], uuid[5], uuid[6], uuid[7]); uuid[4], uuid[5], uuid[6], uuid[7],
uuid[8], uuid[9], uuid[10], uuid[11],
uuid[12], uuid[13], uuid[14], uuid[15]);
vic_provinfo_add_tlv(vp, vic_provinfo_add_tlv(vp,
VIC_LINUX_PROV_TLV_CLIENT_UUID_STR, VIC_LINUX_PROV_TLV_CLIENT_UUID_STR,
sizeof(uuid_str), uuid_str); sizeof(uuid_str), uuid_str);
} }
if (host_uuid) { if (host_uuid) {
uuid = (unsigned short *)host_uuid; uuid = host_uuid;
sprintf(uuid_str, uuid_fmt, sprintf(uuid_str, uuid_fmt,
uuid[0], uuid[1], uuid[2], uuid[3], uuid[0], uuid[1], uuid[2], uuid[3],
uuid[4], uuid[5], uuid[6], uuid[7]); uuid[4], uuid[5], uuid[6], uuid[7],
uuid[8], uuid[9], uuid[10], uuid[11],
uuid[12], uuid[13], uuid[14], uuid[15]);
vic_provinfo_add_tlv(vp, vic_provinfo_add_tlv(vp,
VIC_LINUX_PROV_TLV_HOST_UUID_STR, VIC_LINUX_PROV_TLV_HOST_UUID_STR,
sizeof(uuid_str), uuid_str); sizeof(uuid_str), uuid_str);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment