From: Dotan Barak <dot...@dev.mellanox.co.il> When converting a string to a numeric value, strtol() is more safe to use.
Signed-off-by: Dotan Barak <dot...@dev.mellanox.co.il> Signed-off-by: Or Gerlitz <ogerl...@mellanox.com> --- src/mlx4.c | 4 ++-- 1 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/mlx4.c b/src/mlx4.c index 4989c46..0a9139f 100644 --- a/src/mlx4.c +++ b/src/mlx4.c @@ -224,12 +224,12 @@ static struct ibv_device *mlx4_driver_init(const char *uverbs_sys_path, if (ibv_read_sysfs_file(uverbs_sys_path, "device/vendor", value, sizeof value) < 0) return NULL; - sscanf(value, "%i", &vendor); + vendor = strtol(value, NULL, 16); if (ibv_read_sysfs_file(uverbs_sys_path, "device/device", value, sizeof value) < 0) return NULL; - sscanf(value, "%i", &device); + device = strtol(value, NULL, 16); for (i = 0; i < sizeof hca_table / sizeof hca_table[0]; ++i) if (vendor == hca_table[i].vendor && -- 1.7.1 -- To unsubscribe from this list: send the line "unsubscribe linux-rdma" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html