Skip to content

Commit c9c9c68

Browse files
hcleesmfrench
authored andcommitted
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 <[email protected]> Signed-off-by: Steve French <[email protected]>
1 parent 50630b3 commit c9c9c68

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

fs/cifs/smb2ops.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -557,8 +557,8 @@ parse_server_interfaces(struct network_interface_info_ioctl_rsp *buf,
557557
p = buf;
558558
while (bytes_left >= sizeof(*p)) {
559559
info->speed = le64_to_cpu(p->LinkSpeed);
560-
info->rdma_capable = le32_to_cpu(p->Capability & RDMA_CAPABLE);
561-
info->rss_capable = le32_to_cpu(p->Capability & RSS_CAPABLE);
560+
info->rdma_capable = le32_to_cpu(p->Capability & RDMA_CAPABLE) ? 1 : 0;
561+
info->rss_capable = le32_to_cpu(p->Capability & RSS_CAPABLE) ? 1 : 0;
562562

563563
cifs_dbg(FYI, "%s: adding iface %zu\n", __func__, *iface_count);
564564
cifs_dbg(FYI, "%s: speed %zu bps\n", __func__, info->speed);

0 commit comments

Comments
 (0)