All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Gustavo A. R. Silva" <gustavo@embeddedor.com>
To: David Howells <dhowells@redhat.com>
Cc: linux-afs@lists.infradead.org, linux-kernel@vger.kernel.org,
	"Gustavo A. R. Silva" <gustavo@embeddedor.com>
Subject: [PATCH] afs: Fix logically dead code in afs_update_cell
Date: Mon, 27 May 2019 11:54:13 -0500	[thread overview]
Message-ID: <20190527165413.GA26714@embeddedor> (raw)

Fix logically dead code in switch statement.

Notice that *ret* is updated with -ENOMEM before the switch statement
at 395:

395                 switch (ret) {
396                 case -ENODATA:
397                 case -EDESTADDRREQ:
398                         vllist->status = DNS_LOOKUP_GOT_NOT_FOUND;
399                         break;
400                 case -EAGAIN:
401                 case -ECONNREFUSED:
402                         vllist->status = DNS_LOOKUP_GOT_TEMP_FAILURE;
403                         break;
404                 default:
405                         vllist->status = DNS_LOOKUP_GOT_LOCAL_FAILURE;
406                         break;
407                 }

hence, the code in the switch (except for the default case) makes
no sense and is logically dead.

Fix this by removing the *ret* assignment at 390:

390	ret = -ENOMEM;

which is apparently wrong.

Addresses-Coverity-ID: 1445439 ("Logically dead code")
Fixes: d5c32c89b208 ("afs: Fix cell DNS lookup")
Signed-off-by: Gustavo A. R. Silva <gustavo@embeddedor.com>
---
 fs/afs/cell.c | 1 -
 1 file changed, 1 deletion(-)

diff --git a/fs/afs/cell.c b/fs/afs/cell.c
index 9c3b07ba2222..980de60bf060 100644
--- a/fs/afs/cell.c
+++ b/fs/afs/cell.c
@@ -387,7 +387,6 @@ static int afs_update_cell(struct afs_cell *cell)
 		if (ret == -ENOMEM)
 			goto out_wake;
 
-		ret = -ENOMEM;
 		vllist = afs_alloc_vlserver_list(0);
 		if (!vllist)
 			goto out_wake;
-- 
2.21.0


             reply	other threads:[~2019-05-27 16:54 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-05-27 16:54 Gustavo A. R. Silva [this message]
2019-05-28 15:42 ` [PATCH] afs: Fix logically dead code in afs_update_cell Marc Dionne
2019-05-28 16:11   ` David Howells

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20190527165413.GA26714@embeddedor \
    --to=gustavo@embeddedor.com \
    --cc=dhowells@redhat.com \
    --cc=linux-afs@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.