On 7 April 2014 04:34, Ben Hutchings <b...@decadent.org.uk> wrote:
> Agreed; what do you think of this patch?
[...]
> From: Ben Hutchings <b...@decadent.org.uk>
> Date: Mon, 07 Apr 2014 03:29:24 +0100
> Subject: cifs: cifs_iovec_write(): fix use of uninitialised var
> Bug-Debian: https://bugs.debian.org/741952
> Forwarded: not-needed
>
> If the first call to cifs_reopen_file() from cifs_iovec_write() fails,
> written is not initialised.  We must check rc before written.
>
> ---
> --- a/fs/cifs/file.c
> +++ b/fs/cifs/file.c
> @@ -2194,15 +2194,17 @@ cifs_iovec_write(struct file *file, cons
>                 for (i = 0; i < npages; i++)
>                         kunmap(pages[i]);
>
> +               if (rc < 0) {
> +                       if (!total_written)
> +                               total_written = rc;
> +                       break;
> +               }
> +
>                 if (written) {
>                         len -= written;
>                         total_written += written;
>                         cifs_update_eof(CIFS_I(inode), *poffset, written);
>                         *poffset += written;
> -               } else if (rc < 0) {
> -                       if (!total_written)
> -                               total_written = rc;
> -                       break;
>                 }
>
>                 /* get length and number of kvecs of the next write */
>

Looks good to me.

Thanks,
-- 
Raphael Geissert - Debian Developer
www.debian.org - get.debian.net


-- 
To UNSUBSCRIBE, email to debian-bugs-dist-requ...@lists.debian.org
with a subject of "unsubscribe". Trouble? Contact listmas...@lists.debian.org

Reply via email to