diff mbox series

CIFS: fix structurally dead code in smb311_posix_mkdir

Message ID 20180621133523.GA30313@embeddedor.com
State New
Headers show
Series CIFS: fix structurally dead code in smb311_posix_mkdir | expand

Commit Message

Gustavo A. R. Silva June 21, 2018, 1:35 p.m. UTC
Code at line: 1950: rc = -EIO; is unreachable. Hence, the function
returns rc with a value of zero and, this is not the actual intention
of this particular piece of code.

Fix this by placing the goto instruction just after the update to rc.

Addresses-Coverity-ID: 1470124 ("Structurally dead code")
Fixes: 5539e9b24a38 ("CIFS: fix memory leak and remove dead code")
Signed-off-by: Gustavo A. R. Silva <gustavo@embeddedor.com>
---
 fs/cifs/smb2pdu.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Steve French June 21, 2018, 4:59 p.m. UTC | #1
Folded this patch and the equivalent one from Dan in with the comments
from Aurelien  into one patch and repushed to cifs-2.6.git for-next -
see attached.

On Thu, Jun 21, 2018 at 8:35 AM, Gustavo A. R. Silva
<gustavo@embeddedor.com> wrote:
> Code at line: 1950: rc = -EIO; is unreachable. Hence, the function
> returns rc with a value of zero and, this is not the actual intention
> of this particular piece of code.
>
> Fix this by placing the goto instruction just after the update to rc.
>
> Addresses-Coverity-ID: 1470124 ("Structurally dead code")
> Fixes: 5539e9b24a38 ("CIFS: fix memory leak and remove dead code")
> Signed-off-by: Gustavo A. R. Silva <gustavo@embeddedor.com>
> ---
>  fs/cifs/smb2pdu.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/fs/cifs/smb2pdu.c b/fs/cifs/smb2pdu.c
> index 062a2a5..c9489b1 100644
> --- a/fs/cifs/smb2pdu.c
> +++ b/fs/cifs/smb2pdu.c
> @@ -1946,8 +1946,8 @@ int smb311_posix_mkdir(const unsigned int xid, struct inode *inode,
>         if (ses && (ses->server))
>                 server = ses->server;
>         else {
> -               goto err_free_path;
>                 rc = -EIO;
> +               goto err_free_path;
>         }
>
>         /* resource #2: request */
> --
> 2.7.4
>
> --
> To unsubscribe from this list: send the line "unsubscribe linux-cifs" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
Gustavo A. R. Silva June 21, 2018, 5:36 p.m. UTC | #2
On 06/21/2018 11:59 AM, Steve French wrote:
> Folded this patch and the equivalent one from Dan in with the comments
> from Aurelien  into one patch and repushed to cifs-2.6.git for-next -
> see attached.
> 

Fine. You can add my Signed-off-by

Thanks
--
Gustavo
--
To unsubscribe from this list: send the line "unsubscribe linux-cifs" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
diff mbox series

Patch

diff --git a/fs/cifs/smb2pdu.c b/fs/cifs/smb2pdu.c
index 062a2a5..c9489b1 100644
--- a/fs/cifs/smb2pdu.c
+++ b/fs/cifs/smb2pdu.c
@@ -1946,8 +1946,8 @@  int smb311_posix_mkdir(const unsigned int xid, struct inode *inode,
 	if (ses && (ses->server))
 		server = ses->server;
 	else {
-		goto err_free_path;
 		rc = -EIO;
+		goto err_free_path;
 	}
 
 	/* resource #2: request */