From mboxrd@z Thu Jan 1 00:00:00 1970 From: Ferruh Yigit Subject: Re: [PATCH 02/11] net/sfc/base: improve API to get supported filter matches Date: Tue, 7 Mar 2017 13:25:00 +0000 Message-ID: <0305e912-1d88-f6d5-39b4-dec8c410475c@intel.com> References: <1488470591-5853-1-git-send-email-arybchenko@solarflare.com> <1488470591-5853-3-git-send-email-arybchenko@solarflare.com> Mime-Version: 1.0 Content-Type: text/plain; charset=windows-1252 Content-Transfer-Encoding: 7bit Cc: Mark Spender To: Andrew Rybchenko , dev@dpdk.org Return-path: Received: from mga06.intel.com (mga06.intel.com [134.134.136.31]) by dpdk.org (Postfix) with ESMTP id A9130108A for ; Tue, 7 Mar 2017 14:25:03 +0100 (CET) In-Reply-To: <1488470591-5853-3-git-send-email-arybchenko@solarflare.com> 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 3/2/2017 4:03 PM, Andrew Rybchenko wrote: > From: Mark Spender > > The previous API had various problems, including the length of the > caller provided buffer not being specified, no means being available > to discover how big the buffer needs to be, and a lack of clarity of > what the resulting list contains. > > To improve it: > - add the buffer length as a parameter > - if the provided buffer is too short, fail with ENOSPC and return > the required length > - ensure that the list contents are valid and add comments describing it > > It is safe to change this API as, unsuprisingly, it has no users. > > Signed-off-by: Mark Spender > Signed-off-by: Andrew Rybchenko <...> > > - *length = index; > - memcpy(list, rx_matches, *length); > + memcpy(buffer, rx_matches, list_length * sizeof (rx_matches[0])); Checkpatch warning: WARNING:SPACING: space prohibited between function name and open parenthesis '(' #326: FILE: drivers/net/sfc/base/efx_filter.c:1410: + memcpy(buffer, rx_matches, list_length * sizeof (rx_matches[0]))