2014-04-15 08:07:22

by Michael Opdenacker

[permalink] [raw]
Subject: [PATCH] cif: fix dead code

This issue was found by Coverity (CID 1202536)

This proposes a fix for a statement that creates dead code.
The "rc < 0" statement is within code that is run
with "rc > 0".

It seems like "err < 0" was meant to be used here.
This way, the error code is returned by the function.

Signed-off-by: Michael Opdenacker <[email protected]>
---
fs/cifs/file.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/fs/cifs/file.c b/fs/cifs/file.c
index 8add25538a3b..b6e78632fa97 100644
--- a/fs/cifs/file.c
+++ b/fs/cifs/file.c
@@ -2599,7 +2599,7 @@ cifs_writev(struct kiocb *iocb, const struct iovec *iov,
ssize_t err;

err = generic_write_sync(file, iocb->ki_pos - rc, rc);
- if (rc < 0)
+ if (err < 0)
rc = err;
}
} else {
--
1.8.3.2


2014-04-15 08:16:17

by Al Viro

[permalink] [raw]
Subject: Re: [PATCH] cif: fix dead code

On Tue, Apr 15, 2014 at 10:06:50AM +0200, Michael Opdenacker wrote:
> This issue was found by Coverity (CID 1202536)
>
> This proposes a fix for a statement that creates dead code.
> The "rc < 0" statement is within code that is run
> with "rc > 0".
>
> It seems like "err < 0" was meant to be used here.
> This way, the error code is returned by the function.

Acked-by: Al Viro <[email protected]>

2014-04-17 04:10:26

by Steve French

[permalink] [raw]
Subject: Re: [PATCH] cif: fix dead code

merged into cifs-2.6.git

On Tue, Apr 15, 2014 at 3:06 AM, Michael Opdenacker
<[email protected]> wrote:
> This issue was found by Coverity (CID 1202536)
>
> This proposes a fix for a statement that creates dead code.
> The "rc < 0" statement is within code that is run
> with "rc > 0".
>
> It seems like "err < 0" was meant to be used here.
> This way, the error code is returned by the function.
>
> Signed-off-by: Michael Opdenacker <[email protected]>
> ---
> fs/cifs/file.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/fs/cifs/file.c b/fs/cifs/file.c
> index 8add25538a3b..b6e78632fa97 100644
> --- a/fs/cifs/file.c
> +++ b/fs/cifs/file.c
> @@ -2599,7 +2599,7 @@ cifs_writev(struct kiocb *iocb, const struct iovec *iov,
> ssize_t err;
>
> err = generic_write_sync(file, iocb->ki_pos - rc, rc);
> - if (rc < 0)
> + if (err < 0)
> rc = err;
> }
> } else {
> --
> 1.8.3.2
>
> --
> To unsubscribe from this list: send the line "unsubscribe linux-cifs" in
> the body of a message to [email protected]
> More majordomo info at http://vger.kernel.org/majordomo-info.html



--
Thanks,

Steve