• Julian Wiedmann's avatar
    s390/qeth: overhaul L3 IP address dump code · e6b1b7da
    Julian Wiedmann authored
    The current code that dumps the RXIP/VIPA/IPATO addresses via sysfs
    first checks whether the buffer still provides sufficient space to hold
    another formatted address.
    But the maximum length of an formatted IPv4 address is 15 characters,
    not 12. So we underestimate the max required length and if the buffer
    was previously filled to _just_ the right level, a formatted address can
    end up being truncated.
    
    Revamp these code paths to use the _actually_ required length of the
    formatted IP address, and while at it suppress a gratuitous newline.
    
    Also use scnprintf() to format the output. In case of a truncation, this
    would allow us to return the number of characters that were actually
    written.
    Signed-off-by: default avatarJulian Wiedmann <jwi@linux.ibm.com>
    Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
    e6b1b7da
qeth_l3_sys.c 23.5 KB