From mboxrd@z Thu Jan 1 00:00:00 1970 From: Thomas Monjalon Subject: Re: [PATCH v1] eal: fix negative value incorrectly being used defect Date: Sat, 12 Dec 2015 22:03:15 +0100 Message-ID: <10010035.bssIcGskrK@xps13> References: <1449798537-3221-1-git-send-email-cunming.liang@intel.com> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7Bit Cc: dev@dpdk.org To: Cunming Liang Return-path: Received: from mail-wm0-f54.google.com (mail-wm0-f54.google.com [74.125.82.54]) by dpdk.org (Postfix) with ESMTP id 66BDB8E71 for ; Sat, 12 Dec 2015 22:04:32 +0100 (CET) Received: by wmnn186 with SMTP id n186so74731541wmn.0 for ; Sat, 12 Dec 2015 13:04:32 -0800 (PST) In-Reply-To: List-Id: patches and discussions about DPDK List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" 2015-12-11 15:54, David Marchand: > Hello Cunming, > > On Fri, Dec 11, 2015 at 2:48 AM, Cunming Liang > wrote: > > > In eal_intr_proc_rxtx_intr, negative value may be used as argument to a > > function expecting a positive value. If 'read' returns EAGAIN as example, > > the bytes_read updates to a negative value which continue be passed as > > argument for the next 'read'. > > > > Coverity issue: 107115 > > > > 927 do { > > 3. negative_return_fn: Function read(fd, &buf, bytes_read) returns a > > negative number. > > 4. var_assign: Assigning: signed variable bytes_read = read. > > CID 107115 (#1 of 1): Argument cannot be negative > > (NEGATIVE_RETURNS)9. negative_returns: bytes_read is passed to a > > parameter > > that cannot be negative. > > 928 bytes_read = read(fd, &buf, bytes_read); > > > > Fixes: c9f3ec1a0f3f ("eal/linux: add Rx interrupt control function") > > > > Signed-off-by: Cunming Liang > > > > Acked-by: David Marchand Applied, thanks