提交 1ca817ed 编写于 作者: H Hyunchul Lee 提交者: Yang Yingliang

cifs: fix the out of range assignment to bit fields in parse_server_interfaces

stable inclusion
from linux-4.19.200
commit c30f239f06f6b1a6c0a6ddb2a3d628a815415f0d

--------------------------------

[ Upstream commit c9c9c681 ]

Because the out of range assignment to bit fields
are compiler-dependant, the fields could have wrong
value.
Signed-off-by: NHyunchul Lee <hyc.lee@gmail.com>
Signed-off-by: NSteve French <stfrench@microsoft.com>
Signed-off-by: NSasha Levin <sashal@kernel.org>
Signed-off-by: NYang Yingliang <yangyingliang@huawei.com>
上级 bcb92058
...@@ -386,8 +386,8 @@ parse_server_interfaces(struct network_interface_info_ioctl_rsp *buf, ...@@ -386,8 +386,8 @@ parse_server_interfaces(struct network_interface_info_ioctl_rsp *buf,
p = buf; p = buf;
while (bytes_left >= sizeof(*p)) { while (bytes_left >= sizeof(*p)) {
info->speed = le64_to_cpu(p->LinkSpeed); info->speed = le64_to_cpu(p->LinkSpeed);
info->rdma_capable = le32_to_cpu(p->Capability & RDMA_CAPABLE); info->rdma_capable = le32_to_cpu(p->Capability & RDMA_CAPABLE) ? 1 : 0;
info->rss_capable = le32_to_cpu(p->Capability & RSS_CAPABLE); info->rss_capable = le32_to_cpu(p->Capability & RSS_CAPABLE) ? 1 : 0;
cifs_dbg(FYI, "%s: adding iface %zu\n", __func__, *iface_count); cifs_dbg(FYI, "%s: adding iface %zu\n", __func__, *iface_count);
cifs_dbg(FYI, "%s: speed %zu bps\n", __func__, info->speed); cifs_dbg(FYI, "%s: speed %zu bps\n", __func__, info->speed);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册