smb3: pass mode bits into create calls
Subsystems (2)
Hello Steve French,
The patch c3ca78e21744: "smb3: pass mode bits into create calls" from Sep 25, 2019, leads to the following static checker warning:
fs/cifs/smb2pdu.c:754 add_posix_context() warn: impossible condition '(mode == -1) => (0-u16max == (-1))'
fs/cifs/smb2pdu.c
747 static int
748 add_posix_context(struct kvec *iov, unsigned int *num_iovec, umode_t mode)
^^^^^^^
This is unsigned short.
749 {
750 struct smb2_create_req *req = iov[0].iov_base;
751 unsigned int num = *num_iovec;
752
753 iov[num].iov_base = create_posix_buf(mode);
754 if (mode == -1)
^^^^^^^^^^
So this debug code will never trigger.
755 cifs_dbg(VFS, "illegal mode\n"); /* BB REMOVEME */ 756 if (iov[num].iov_base == NULL) 757 return -ENOMEM; 758 iov[num].iov_len = sizeof(struct create_posix); 759 if (!req->CreateContextsOffset) 760 req->CreateContextsOffset = cpu_to_le32( 761 sizeof(struct smb2_create_req) + 762 iov[num - 1].iov_len); 763 le32_add_cpu(&req->CreateContextsLength, sizeof(struct create_posix)); 764 *num_iovec = num + 1; 765 return 0; 766 }
regards,
dan carpenter