Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 10 additions & 4 deletions nvme-print-json.c
Original file line number Diff line number Diff line change
Expand Up @@ -5632,16 +5632,22 @@ static void json_host_discovery_log(struct nvme_host_discover_log *log)

static void obj_add_traddr(struct json_object *o, const char *k, __u8 adrfam, __u8 *traddr)
{
int af = AF_INET;
socklen_t size = INET_ADDRSTRLEN;
char dst[INET6_ADDRSTRLEN];
socklen_t size;
int af;

if (adrfam == NVMF_ADDR_FAMILY_IP6) {
if (adrfam == NVMF_ADDR_FAMILY_IP4) {
af = AF_INET;
size = INET_ADDRSTRLEN;
} else if (adrfam == NVMF_ADDR_FAMILY_IP6) {
af = AF_INET6;
size = INET6_ADDRSTRLEN;
} else {
obj_add_str(o, k, "<invalid>");
return;
}

if (inet_ntop(af, libnvmf_adrfam_str(adrfam), dst, size))
if (inet_ntop(af, traddr, dst, size))
obj_add_str(o, k, dst);
}

Expand Down
14 changes: 10 additions & 4 deletions nvme-print-stdout.c
Original file line number Diff line number Diff line change
Expand Up @@ -6642,16 +6642,22 @@ static void stdout_host_discovery_log(struct nvme_host_discover_log *log)

static void print_traddr(char *field, __u8 adrfam, __u8 *traddr)
{
int af = AF_INET;
socklen_t size = INET_ADDRSTRLEN;
char dst[INET6_ADDRSTRLEN];
socklen_t size;
int af;
Comment on lines +6646 to +6647
Copy link

Copilot AI Apr 22, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

socklen_t size is missing a trailing semicolon, which will break compilation. Add ; after the declaration.

Copilot uses AI. Check for mistakes.

if (adrfam == NVMF_ADDR_FAMILY_IP6) {
if (adrfam == NVMF_ADDR_FAMILY_IP4) {
af = AF_INET;
size = INET_ADDRSTRLEN;
} else if (adrfam == NVMF_ADDR_FAMILY_IP6) {
af = AF_INET6;
size = INET6_ADDRSTRLEN;
} else {
printf("%s: <invalid>\n", field);
return;
}

if (inet_ntop(af, libnvmf_adrfam_str(adrfam), dst, size))
if (inet_ntop(af, traddr, dst, size))
printf("%s: %s\n", field, dst);
}

Expand Down
Loading