summaryrefslogtreecommitdiffstats
path: root/fs/cifs
diff options
context:
space:
mode:
authorHyunchul Lee <hyc.lee@gmail.com>2021-07-12 19:34:02 +0900
committerSteve French <stfrench@microsoft.com>2021-07-14 10:06:33 -0500
commitc9c9c6815f9004ee1ec87401ed0796853bd70f1b (patch)
tree81e29c7d67feb1dd3d195418fa7a464bb9d5a624 /fs/cifs
parent50630b3f1ada0bf412d3f28e73bac310448d9d6f (diff)
downloadlinux-stable-c9c9c6815f9004ee1ec87401ed0796853bd70f1b.tar.gz
linux-stable-c9c9c6815f9004ee1ec87401ed0796853bd70f1b.tar.bz2
linux-stable-c9c9c6815f9004ee1ec87401ed0796853bd70f1b.zip
cifs: fix the out of range assignment to bit fields in parse_server_interfaces
Because the out of range assignment to bit fields are compiler-dependant, the fields could have wrong value. Signed-off-by: Hyunchul Lee <hyc.lee@gmail.com> Signed-off-by: Steve French <stfrench@microsoft.com>
Diffstat (limited to 'fs/cifs')
-rw-r--r--fs/cifs/smb2ops.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/fs/cifs/smb2ops.c b/fs/cifs/smb2ops.c
index e4c8f603dd58..232d528df230 100644
--- a/fs/cifs/smb2ops.c
+++ b/fs/cifs/smb2ops.c
@@ -557,8 +557,8 @@ parse_server_interfaces(struct network_interface_info_ioctl_rsp *buf,
p = buf;
while (bytes_left >= sizeof(*p)) {
info->speed = le64_to_cpu(p->LinkSpeed);
- info->rdma_capable = le32_to_cpu(p->Capability & RDMA_CAPABLE);
- info->rss_capable = le32_to_cpu(p->Capability & RSS_CAPABLE);
+ info->rdma_capable = le32_to_cpu(p->Capability & RDMA_CAPABLE) ? 1 : 0;
+ 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: speed %zu bps\n", __func__, info->speed);