Re: [patch v2] CIFS: cleanup min_t() cast in cifs_read()

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



merged.

On Tue, Oct 18, 2011 at 4:41 AM, Dan Carpenter <dan.carpenter@xxxxxxxxxx> wrote:
> 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: Dan Carpenter <dan.carpenter@xxxxxxxxxx>
> ---
> v2:  use "uint" instead of "u32".
>
> diff --git a/fs/cifs/file.c b/fs/cifs/file.c
> index ab85699..34be15a 100644
> --- a/fs/cifs/file.c
> +++ b/fs/cifs/file.c
> @@ -1900,13 +1900,13 @@ static ssize_t cifs_read(struct file *file, char *read_data, size_t read_size,
>        for (total_read = 0, current_offset = read_data;
>             read_size > total_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);
>                /* For windows me and 9x we do not want to request more
>                than it negotiated since it will refuse the read then */
>                if ((pTcon->ses) &&
>                        !(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);
>                }
>                rc = -EAGAIN;
>



-- 
Thanks,

Steve
--
To unsubscribe from this list: send the line "unsubscribe kernel-janitors" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [Kernel Development]     [Kernel Announce]     [Kernel Newbies]     [Linux Networking Development]     [Share Photos]     [IDE]     [Security]     [Git]     [Netfilter]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Device Mapper]

  Powered by Linux