On 8/21/2020 6:10 PM, Bruce Richardson wrote:
When producing a printable mac address the buffer was appropriately sized
for holding the mac address exactly, but the actual snprintf included a
'\n' character at the end, which means that the snprintf technically is
getting truncated i.e. the \n would not be added due to lack of space.
This gets flagged as a problem by modern versions of gcc, e.g. on Ubuntu
20.04.

main.c:77:37: warning: ‘__builtin___snprintf_chk’ output truncated before the 
last format character [-Wformat-truncation=]
    77 |     "%02x:%02x:%02x:%02x:%02x:%02x\n",
       |                                     ^

Since the \n is getting stripped anyway, we can fix the issue by just
removing it. In the process we can switch to using the standard ethernet
address formating function from rte_ether.h.

Fixes: af75078fece3 ("first public release")
Cc: sta...@dpdk.org
Cc: Stephen Hemminger <step...@networkplumber.org>

Signed-off-by: Bruce Richardson <bruce.richard...@intel.com>

---
V2: switched code to use standard formatting function
---

Acked-by: Radu Nicolau <radu.nico...@intel.com>

Reply via email to