From mboxrd@z Thu Jan 1 00:00:00 1970 From: =?iso-8859-1?Q?Ga=EBtan?= Rivet Subject: Re: [PATCH] ethdev: fix invalid length write on dev detach Date: Mon, 31 Jul 2017 15:29:12 +0200 Message-ID: <20170731132911.GK11154@bidouze.vm.6wind.com> References: <1757afd2673591a59ebd69cef7b569d344f20e7c.1501496827.git.gaetan.rivet@6wind.com> <3370483.kKZ7asuQTK@xps> Mime-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Transfer-Encoding: 8bit Cc: dev@dpdk.org, Ferruh Yigit To: Thomas Monjalon Return-path: Received: from mail-wr0-f171.google.com (mail-wr0-f171.google.com [209.85.128.171]) by dpdk.org (Postfix) with ESMTP id 45D905598 for ; Mon, 31 Jul 2017 15:29:22 +0200 (CEST) Received: by mail-wr0-f171.google.com with SMTP id f21so122819184wrf.5 for ; Mon, 31 Jul 2017 06:29:22 -0700 (PDT) Content-Disposition: inline In-Reply-To: <3370483.kKZ7asuQTK@xps> List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" On Mon, Jul 31, 2017 at 03:27:29PM +0200, Thomas Monjalon wrote: > 31/07/2017 12:29, Gaetan Rivet: > > 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. > > Yes we must discuss the future of this API function. > > In the meantime, this limitation (size expectation) should be documented > in the doxygen comment. v2 please? > Sure -- Gaëtan Rivet 6WIND