forked from luck/tmp_suning_uos_patched
net/mlx4_core: Replace sscanf() with kstrtoint()
It is not safe to use sscanf. Signed-off-by: Dotan Barak <dotanb@dev.mellanox.com> Signed-off-by: Vladimir Sokolovsky <vlad@mellanox.com> Signed-off-by: Amir Vadai <amirv@mellanox.com> Signed-off-by: David S. Miller <davem@davemloft.net>
This commit is contained in:
parent
42f1e9020e
commit
618fad954b
|
@ -839,11 +839,11 @@ static ssize_t set_port_ib_mtu(struct device *dev,
|
|||
return -EINVAL;
|
||||
}
|
||||
|
||||
err = sscanf(buf, "%d", &mtu);
|
||||
if (err > 0)
|
||||
err = kstrtoint(buf, 0, &mtu);
|
||||
if (!err)
|
||||
ibta_mtu = int_to_ibta_mtu(mtu);
|
||||
|
||||
if (err <= 0 || ibta_mtu < 0) {
|
||||
if (err || ibta_mtu < 0) {
|
||||
mlx4_err(mdev, "%s is invalid IBTA mtu\n", buf);
|
||||
return -EINVAL;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue
Block a user