• Jacob Keller's avatar
    i40evf: fix possible snprintf truncation of q_vector->name · 696ac80a
    Jacob Keller authored
    The q_vector names are based on the interface name with a driver prefix,
    the type of q_vector setup, and the queue number. We previously set the
    size of this variable to IFNAMSIZ + 9, which is incorrect, because we
    actually include a minimum of 14 characters extra beyond the interface
    name size.
    
    New versions of GCC since 7 include a new warning that detects this
    possible truncation and complains. We can fix this by increasing the
    size in case our interface name is too large to avoid truncation. We
    don't need to go beyond 14 because the compiler is smart enough to
    realize our values can never exceed size of 1. We do go up to 15 here
    because possible future changes may increase the number of queues beyond
    one digit.
    
    While we are here, also change some variables to be unsigned (since they
    are never negative) and stop using an extra unnecessary %s format
    specifier.
    Signed-off-by: default avatarJacob Keller <jacob.e.keller@intel.com>
    Tested-by: default avatarAndrew Bowers <andrewx.bowers@intel.com>
    Signed-off-by: default avatarJeff Kirsher <jeffrey.t.kirsher@intel.com>
    696ac80a
i40evf_main.c 83.9 KB