Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 7748dd6e authored by Dan Carpenter's avatar Dan Carpenter Committed by Steve French
Browse files

CIFS: cleanup min_t() cast in cifs_read()



Smatch complains that the cast to "int" in min_t() changes very large
values of current_read_size into negative values and so min_t()
could return the wrong value.  I removed the const as well, as that
doesn't do anything here.

Signed-off-by: default avatarDan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: default avatarSteve French <smfrench@gmail.com>
parent a5ff3769
Loading
Loading
Loading
Loading
+2 −2
Original line number Original line Diff line number Diff line
@@ -1904,13 +1904,13 @@ static ssize_t cifs_read(struct file *file, char *read_data, size_t read_size,
	for (total_read = 0, current_offset = read_data;
	for (total_read = 0, current_offset = read_data;
	     read_size > total_read;
	     read_size > total_read;
	     total_read += bytes_read, current_offset += bytes_read) {
	     total_read += bytes_read, current_offset += bytes_read) {
		current_read_size = min_t(const int, read_size - total_read,
		current_read_size = min_t(uint, read_size - total_read,
					  cifs_sb->rsize);
					  cifs_sb->rsize);
		/* For windows me and 9x we do not want to request more
		/* For windows me and 9x we do not want to request more
		than it negotiated since it will refuse the read then */
		than it negotiated since it will refuse the read then */
		if ((pTcon->ses) &&
		if ((pTcon->ses) &&
			!(pTcon->ses->capabilities & CAP_LARGE_FILES)) {
			!(pTcon->ses->capabilities & CAP_LARGE_FILES)) {
			current_read_size = min_t(const int, current_read_size,
			current_read_size = min_t(uint, current_read_size,
					CIFSMaxBufSize);
					CIFSMaxBufSize);
		}
		}
		rc = -EAGAIN;
		rc = -EAGAIN;