diff options
author | Dotan Barak <dotanb@dev.mellanox.co.il> | 2012-09-20 20:31:03 +0000 |
---|---|---|
committer | Roland Dreier <roland@purestorage.com> | 2013-04-03 11:21:44 -0700 |
commit | 2ca39871bed5ef380a3133ca89bf81fb2f2e2181 (patch) | |
tree | 0ee26d462e315b8ff383337a27d0acc5c85d509a | |
parent | 9a901768806221f259fc448a0f0a9da96e7886d0 (diff) | |
download | libmlx4-2ca39871bed5ef380a3133ca89bf81fb2f2e2181.tar.gz |
Replace sscanf() with strtol()
When converting a string to a numeric value, strtol() is safer to use.
Signed-off-by: Dotan Barak <dotanb@dev.mellanox.co.il>
Signed-off-by: Or Gerlitz <ogerlitz@mellanox.com>
Signed-off-by: Roland Dreier <roland@purestorage.com>
-rw-r--r-- | src/mlx4.c | 4 |
1 files changed, 2 insertions, 2 deletions
@@ -229,12 +229,12 @@ static struct ibv_device *mlx4_driver_init(const char *uverbs_sys_path, int abi_ 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 && |