提交 618fad95 编写于 作者: D Dotan Barak 提交者: David S. Miller

net/mlx4_core: Replace sscanf() with kstrtoint()

It is not safe to use sscanf.
Signed-off-by: NDotan Barak <dotanb@dev.mellanox.com>
Signed-off-by: NVladimir Sokolovsky <vlad@mellanox.com>
Signed-off-by: NAmir Vadai <amirv@mellanox.com>
Signed-off-by: NDavid S. Miller <davem@davemloft.net>
上级 42f1e902
......@@ -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;
}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册