• Florian Fainelli's avatar
    e1000e: Fix -Wformat-truncation warnings · 2643340d
    Florian Fainelli authored
    BugLink: https://bugs.launchpad.net/bugs/1828420
    
    [ Upstream commit 135e7245 ]
    
    Provide precision hints to snprintf() since we know the destination
    buffer size of the RX/TX ring names are IFNAMSIZ + 5 - 1. This fixes the
    following warnings:
    
    drivers/net/ethernet/intel/e1000e/netdev.c: In function
    'e1000_request_msix':
    drivers/net/ethernet/intel/e1000e/netdev.c:2109:13: warning: 'snprintf'
    output may be truncated before the last format character
    [-Wformat-truncation=]
         "%s-rx-0", netdev->name);
                 ^
    drivers/net/ethernet/intel/e1000e/netdev.c:2107:3: note: 'snprintf'
    output between 6 and 21 bytes into a destination of size 20
       snprintf(adapter->rx_ring->name,
       ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
         sizeof(adapter->rx_ring->name) - 1,
         ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
         "%s-rx-0", netdev->name);
         ~~~~~~~~~~~~~~~~~~~~~~~~
    drivers/net/ethernet/intel/e1000e/netdev.c:2125:13: warning: 'snprintf'
    output may be truncated before the last format character
    [-Wformat-truncation=]
         "%s-tx-0", netdev->name);
                 ^
    drivers/net/ethernet/intel/e1000e/netdev.c:2123:3: note: 'snprintf'
    output between 6 and 21 bytes into a destination of size 20
       snprintf(adapter->tx_ring->name,
       ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
         sizeof(adapter->tx_ring->name) - 1,
         ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
         "%s-tx-0", netdev->name);
         ~~~~~~~~~~~~~~~~~~~~~~~~
    Signed-off-by: default avatarFlorian Fainelli <f.fainelli@gmail.com>
    Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
    Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
    Signed-off-by: default avatarKleber Sacilotto de Souza <kleber.souza@canonical.com>
    Signed-off-by: default avatarStefan Bader <stefan.bader@canonical.com>
    2643340d
netdev.c 212 KB