Running fcoeadm commands on i386 displays incorrectly but displays
correctly on x86_64. output is "Onliown" instead of "Online" or
"Gown: instead of "Gbit". These errors are not seen on x86_64 systems.

Output on 32-bit machine:

# fcoeadm -i eth2

HBA #0
    Description:      Unknown
    Revision:         01
    Manufacturer:     Unknown
    Serial Number:    72-b8-12-ff-ff-21-1b-00
    Driver:           ixgbe 1.3.30-k2
    Number of Ports:  1

    Port #0
        Symbolic Name:     fcoe v0.1 over eth2
        Interface Name:    eth2
        OS Device Name:    host3
        Node Name:         0x1000001B2112B872
        Port Name:         0x2000001B2112B872
        FabricName:        0x2001000DEC722101
        Speed:             10 Gown
        Supported Speed:   10 Gown
        MaxFrameSize:      1452
        FC-ID (Port ID):   0x360001
        State:             Onliown

# fcoeadm -t eth2
Target #0 @ eth2
    Roles:            Directory Server
    Node Name:        0x2001000DECA33901
    Port Name:        0x250D000DECA33900
    MaxFrameSize:     1452
    OS Device Name:   rport-3:0-0
    FC-ID (Port ID):  0xFFFFFC
    State:            Onliown

On 64-bit machine sizeof(buf) is 8, longer than the length
of "Unknown", that is why the problem does not show. On the
other hand, on 32-bit machine, sizeof(buf) is 4, shorter
than the length of "Unknown", that is why the problem shows.
Because buf is a pointer, we should use len instead of
sizeof(buf).

Signed-off-by: Steve Ma <[email protected]>
---

 fcoeadm_display.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/fcoeadm_display.c b/fcoeadm_display.c
index bdddb43..9ba3027 100644
--- a/fcoeadm_display.c
+++ b/fcoeadm_display.c
@@ -89,7 +89,7 @@ sa_enum_decode(char *buf, size_t len,
        snprintf(buf, len, "Unknown");
        for (; tp->nv_name != NULL; tp++) {
                if (tp->nv_val == val) {
-                       strncpy(buf, tp->nv_name, sizeof(buf));
+                       strncpy(buf, tp->nv_name, len);
                        break;
                }
        }

_______________________________________________
devel mailing list
[email protected]
http://www.open-fcoe.org/mailman/listinfo/devel

Reply via email to