* [dpdk-dev] [PATCH] enic: Fixed possible data loss in vnic_dev.c
@ 2015-02-20 16:13 Maciej Gajdzica
0 siblings, 0 replies; only message in thread
From: Maciej Gajdzica @ 2015-02-20 16:13 UTC (permalink / raw)
To: 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 <maciejx.t.gajdzica@intel.com>
---
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);
--
1.7.9.5
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2015-02-20 16:14 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-02-20 16:13 [dpdk-dev] [PATCH] enic: Fixed possible data loss in vnic_dev.c Maciej Gajdzica
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).