提交 55fe4ce5 编写于 作者: M Maxime Chevallier 提交者: Xie XiuQi

net: mvpp2: Use strscpy to handle stat strings

[ Upstream commit d37acd5a ]

Use a safe strscpy call to copy the ethtool stat strings into the
relevant buffers, instead of a memcpy that will be accessing
out-of-bound data.

Fixes: 118d6298 ("net: mvpp2: add ethtool GOP statistics")
Signed-off-by: NMaxime Chevallier <maxime.chevallier@bootlin.com>
Signed-off-by: NDavid S. Miller <davem@davemloft.net>
Signed-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: NYang Yingliang <yangyingliang@huawei.com>
上级 b0148b8e
......@@ -1310,8 +1310,8 @@ static void mvpp2_ethtool_get_strings(struct net_device *netdev, u32 sset,
int i;
for (i = 0; i < ARRAY_SIZE(mvpp2_ethtool_regs); i++)
memcpy(data + i * ETH_GSTRING_LEN,
&mvpp2_ethtool_regs[i].string, ETH_GSTRING_LEN);
strscpy(data + i * ETH_GSTRING_LEN,
mvpp2_ethtool_regs[i].string, ETH_GSTRING_LEN);
}
}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册