ethdev: fix invalid length write on detach
authorGaetan Rivet <gaetan.rivet@6wind.com>
Mon, 31 Jul 2017 13:40:07 +0000 (15:40 +0200)
committerThomas Monjalon <thomas@monjalon.net>
Mon, 31 Jul 2017 14:24:12 +0000 (16:24 +0200)
The name of a device is copied in a provided buffer within
rte_eth_dev_detach(). The current sizeof is done on a pointer instead of
the intended array usually pointed to.

The name field of an rte_device is not assured however to point an
rte_devargs name field. The almost correct length to base this copy over
is thus RTE_DEV_NAME_MAX_LEN.

Almost correct, because unfortunately this function does not allow the
user to pass down a size parameter for the buffer it is meant to write.
This API should be fixed, it is broken by design.

Fixes: a1e7c17555e8 ("ethdev: use device name from device structure")
Cc: stable@dpdk.org
Signed-off-by: Gaetan Rivet <gaetan.rivet@6wind.com>

No differences found