From patchwork Fri Feb 20 16:13:59 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Maciej Gajdzica X-Patchwork-Id: 3562 Return-Path: X-Original-To: patchwork@dpdk.org Delivered-To: patchwork@dpdk.org Received: from [92.243.14.124] (localhost [IPv6:::1]) by dpdk.org (Postfix) with ESMTP id 62954B7E1; Fri, 20 Feb 2015 17:14:12 +0100 (CET) Received: from mga01.intel.com (mga01.intel.com [192.55.52.88]) by dpdk.org (Postfix) with ESMTP id 41310B7E1 for ; Fri, 20 Feb 2015 17:14:10 +0100 (CET) Received: from orsmga002.jf.intel.com ([10.7.209.21]) by fmsmga101.fm.intel.com with ESMTP; 20 Feb 2015 08:14:08 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.09,615,1418112000"; d="scan'208";a="688430889" Received: from irvmail001.ir.intel.com ([163.33.26.43]) by orsmga002.jf.intel.com with ESMTP; 20 Feb 2015 08:14:08 -0800 Received: from sivswdev01.ir.intel.com (sivswdev01.ir.intel.com [10.237.217.45]) by irvmail001.ir.intel.com (8.14.3/8.13.6/MailSET/Hub) with ESMTP id t1KGE6PL021282; Fri, 20 Feb 2015 16:14:06 GMT Received: from sivswdev01.ir.intel.com (localhost [127.0.0.1]) by sivswdev01.ir.intel.com with ESMTP id t1KGE6wb006480; Fri, 20 Feb 2015 16:14:06 GMT Received: (from mtgajdzx@localhost) by sivswdev01.ir.intel.com with id t1KGE6Kc006476; Fri, 20 Feb 2015 16:14:06 GMT From: Maciej Gajdzica To: dev@dpdk.org Date: Fri, 20 Feb 2015 16:13:59 +0000 Message-Id: <1424448839-6440-1-git-send-email-maciejx.t.gajdzica@intel.com> X-Mailer: git-send-email 1.7.4.1 Subject: [dpdk-dev] [PATCH] enic: Fixed possible data loss in vnic_dev.c X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list 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" Macro GET_CONFIG passes result of sizeof operation to the function vnic_dev_spec. This function expects parameter of type unsigned int. Changed that parameter type to size_t in function declaration to prevent possible data loss. Issue found with static code analysis tool. Signed-off-by: Maciej Gajdzica --- lib/librte_pmd_enic/vnic/vnic_dev.c | 2 +- lib/librte_pmd_enic/vnic/vnic_dev.h | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/librte_pmd_enic/vnic/vnic_dev.c b/lib/librte_pmd_enic/vnic/vnic_dev.c index 6407994..917eb67 100644 --- a/lib/librte_pmd_enic/vnic/vnic_dev.c +++ b/lib/librte_pmd_enic/vnic/vnic_dev.c @@ -474,7 +474,7 @@ static int vnic_dev_capable(struct vnic_dev *vdev, enum vnic_devcmd_cmd cmd) return !(err || a0); } -int vnic_dev_spec(struct vnic_dev *vdev, unsigned int offset, unsigned int size, +int vnic_dev_spec(struct vnic_dev *vdev, unsigned int offset, size_t size, void *value) { u64 a0, a1; diff --git a/lib/librte_pmd_enic/vnic/vnic_dev.h b/lib/librte_pmd_enic/vnic/vnic_dev.h index ca1174f..f583357 100644 --- a/lib/librte_pmd_enic/vnic/vnic_dev.h +++ b/lib/librte_pmd_enic/vnic/vnic_dev.h @@ -136,7 +136,7 @@ void vnic_dev_cmd_proxy_end(struct vnic_dev *vdev); int vnic_dev_fw_info(struct vnic_dev *vdev, struct vnic_devcmd_fw_info **fw_info); int vnic_dev_asic_info(struct vnic_dev *vdev, u16 *asic_type, u16 *asic_rev); -int vnic_dev_spec(struct vnic_dev *vdev, unsigned int offset, unsigned int size, +int vnic_dev_spec(struct vnic_dev *vdev, unsigned int offset, size_t size, void *value); int vnic_dev_stats_clear(struct vnic_dev *vdev); int vnic_dev_stats_dump(struct vnic_dev *vdev, struct vnic_stats **stats);