From: Dotan Barak <redacted>
When converting a string to a numeric value, strtol() is more safe to use.
Signed-off-by: Dotan Barak <redacted>
Signed-off-by: Or Gerlitz <ogerlitz-VPRAkNaXOzVWk0Htik3J/w@public.gmane.org>
---
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 majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at http://vger.kernel.org/majordomo-info.html