From mboxrd@z Thu Jan 1 00:00:00 1970 From: Yuanhan Liu Subject: Re: [PATCH] vhost: fix unchecked return value of fstat Date: Mon, 20 Jun 2016 15:20:51 +0800 Message-ID: <20160620072051.GF23111@yliu-dev.sh.intel.com> References: <1465926323-30532-1-git-send-email-huawei.xie@intel.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Cc: dev@dpdk.org, michalx.k.jastrzebski@intel.com To: Huawei Xie Return-path: Received: from mga11.intel.com (mga11.intel.com [192.55.52.93]) by dpdk.org (Postfix) with ESMTP id 6F0185699 for ; Mon, 20 Jun 2016 09:20:08 +0200 (CEST) Content-Disposition: inline In-Reply-To: <1465926323-30532-1-git-send-email-huawei.xie@intel.com> 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" On Wed, Jun 15, 2016 at 01:45:23AM +0800, Huawei Xie wrote: > Value returned from fstat is not checked for errors before being used. > Fixes the coverity issue: > > static uint64_t > get_blk_size(int fd) > { > struct stat stat; > > fstat(fd, &stat); > return (uint64_t)stat.st_blksize; > >>> CID 107103 (#1 of 1): Unchecked return value from library (CHECKED_RETURN) > >>> check_return: Calling fstat(fd, &stat) without checking return value. > >>> This library function may fail and return an error code. > > Fixes: 8f972312b8f4 ("vhost: support vhost-user") > > Signed-off-by: Huawei Xie Acked-by: Yuanhan Liu Applied to dpdk-next-virtio. Thanks. --yliu