1. 23 Feb, 2019 5 commits
    • Florian Fainelli's avatar
      veth: Fix -Wformat-truncation · abdf47aa
      Florian Fainelli authored
      Provide a precision hint to snprintf() in order to eliminate a
      -Wformat-truncation warning provided below. A maximum of 11 characters
      is allowed to reach a maximum of 32 - 1 characters given a possible
      maximum value of queues using up to UINT_MAX which occupies 10
      characters. Incidentally 11 is the number of characters for
      "xdp_packets" which is the largest string we append.
      
      drivers/net/veth.c: In function 'veth_get_strings':
      drivers/net/veth.c:118:47: warning: '%s' directive output may be
      truncated writing up to 31 bytes into a region of size between 12 and 21
      [-Wformat-truncation=]
           snprintf(p, ETH_GSTRING_LEN, "rx_queue_%u_%s",
                                                     ^~
      drivers/net/veth.c:118:5: note: 'snprintf' output between 12 and 52
      bytes into a destination of size 32
           snprintf(p, ETH_GSTRING_LEN, "rx_queue_%u_%s",
           ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
             i, veth_rq_stats_desc[j].desc);
             ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
      Signed-off-by: default avatarFlorian Fainelli <f.fainelli@gmail.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      abdf47aa
    • Florian Fainelli's avatar
      e1000e: Fix -Wformat-truncation warnings · 135e7245
      Florian Fainelli authored
      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>
      135e7245
    • Florian Fainelli's avatar
      net: dsa: mv88e6xxx: Fix -Wformat-security warnings · 3f8b8696
      Florian Fainelli authored
      We are not specifying an explicit format argument but instead passing a
      string litteral which causes these two warnings to show up:
      
      drivers/net/dsa/mv88e6xxx/chip.c: In function
      'mv88e6xxx_irq_poll_setup':
      drivers/net/dsa/mv88e6xxx/chip.c:483:2: warning: format not a string
      literal and no format arguments [-Wformat-security]
        chip->kworker = kthread_create_worker(0, dev_name(chip->dev));
        ^~~~
      drivers/net/dsa/mv88e6xxx/ptp.c: In function 'mv88e6xxx_ptp_setup':
      drivers/net/dsa/mv88e6xxx/ptp.c:403:4: warning: format not a string
      literal and no format arguments [-Wformat-security]
          dev_name(chip->dev));
          ^~~~~~~~
        LD [M]  drivers/net/dsa/mv88e6xxx/mv88e6xxx.o
      Signed-off-by: default avatarFlorian Fainelli <f.fainelli@gmail.com>
      Reviewed-by: default avatarAndrew Lunn <andrew@lunn.ch>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      3f8b8696
    • Florian Fainelli's avatar
      mlxsw: spectrum: Avoid -Wformat-truncation warnings · ab2c4e25
      Florian Fainelli authored
      Give precision identifiers to the two snprintf() formatting the priority
      and TC strings to avoid producing these two warnings:
      
      drivers/net/ethernet/mellanox/mlxsw/spectrum.c: In function
      'mlxsw_sp_port_get_prio_strings':
      drivers/net/ethernet/mellanox/mlxsw/spectrum.c:2132:37: warning: '%d'
      directive output may be truncated writing between 1 and 3 bytes into a
      region of size between 0 and 31 [-Wformat-truncation=]
         snprintf(*p, ETH_GSTRING_LEN, "%s_%d",
                                           ^~
      drivers/net/ethernet/mellanox/mlxsw/spectrum.c:2132:3: note: 'snprintf'
      output between 3 and 36 bytes into a destination of size 32
         snprintf(*p, ETH_GSTRING_LEN, "%s_%d",
         ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
           mlxsw_sp_port_hw_prio_stats[i].str, prio);
           ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
      drivers/net/ethernet/mellanox/mlxsw/spectrum.c: In function
      'mlxsw_sp_port_get_tc_strings':
      drivers/net/ethernet/mellanox/mlxsw/spectrum.c:2143:37: warning: '%d'
      directive output may be truncated writing between 1 and 11 bytes into a
      region of size between 0 and 31 [-Wformat-truncation=]
         snprintf(*p, ETH_GSTRING_LEN, "%s_%d",
                                           ^~
      drivers/net/ethernet/mellanox/mlxsw/spectrum.c:2143:3: note: 'snprintf'
      output between 3 and 44 bytes into a destination of size 32
         snprintf(*p, ETH_GSTRING_LEN, "%s_%d",
         ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
           mlxsw_sp_port_hw_tc_stats[i].str, tc);
           ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
      Signed-off-by: default avatarFlorian Fainelli <f.fainelli@gmail.com>
      Reviewed-by: default avatarIdo Schimmel <idosch@mellanox.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      ab2c4e25
    • Masahiro Yamada's avatar
      bpfilter: re-add header search paths to tools include to fix build error · dccd3ab5
      Masahiro Yamada authored
      I thought header search paths to tools/include(/uapi) were unneeded,
      but it looks like a build error occurs depending on the compiler.
      
      Commit 303a339f ("bpfilter: remove extra header search paths for
      bpfilter_umh") reintroduced the build error fixed by commit ae40832e
      ("bpfilter: fix a build err").
      
      Apology for the breakage, and thanks to Guenter for reporting this.
      
      Fixes: 303a339f ("bpfilter: remove extra header search paths for bpfilter_umh")
      Reported-by: default avatarGuenter Roeck <linux@roeck-us.net>
      Signed-off-by: default avatarMasahiro Yamada <yamada.masahiro@socionext.com>
      Tested-by: default avatarGuenter Roeck <linux@roeck-us.net>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      dccd3ab5
  2. 22 Feb, 2019 35 commits