mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH] afs: remove redundant overwriting of ret
@ 2023-12-21  8:58 Anastasia Belova
  2023-12-21 14:10 ` David Howells
  0 siblings, 1 reply; 2+ messages in thread
From: Anastasia Belova @ 2023-12-21  8:58 UTC (permalink / raw)
  To: David Howells
  Cc: Anastasia Belova, Marc Dionne, linux-afs, linux-kernel, lvc-project

ret is the result of dns lookup. There are several
ways to handle different errors (described by switch).
So it is necessary to keep the return value of afs_dns_query.

Found by Linux Verification Center (linuxtesting.org) with SVACE.

Fixes: d5c32c89b208 ("afs: Fix cell DNS lookup")
Signed-off-by: Anastasia Belova <abelova@astralinux.ru>
---
 fs/afs/cell.c | 1 -
 1 file changed, 1 deletion(-)

diff --git a/fs/afs/cell.c b/fs/afs/cell.c
index 988c2ac7cece..9a112e03bee1 100644
--- a/fs/afs/cell.c
+++ b/fs/afs/cell.c
@@ -409,7 +409,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.30.2


^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [PATCH] afs: remove redundant overwriting of ret
  2023-12-21  8:58 [PATCH] afs: remove redundant overwriting of ret Anastasia Belova
@ 2023-12-21 14:10 ` David Howells
  0 siblings, 0 replies; 2+ messages in thread
From: David Howells @ 2023-12-21 14:10 UTC (permalink / raw)
  To: Anastasia Belova
  Cc: dhowells, Marc Dionne, linux-afs, linux-kernel, lvc-project

Anastasia Belova <abelova@astralinux.ru> wrote:

> @@ -409,7 +409,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;

This isn't a sufficient fix.

Yes, you're right, we need to keep ret - but we do need to set -ENOMEM if
!vllist if ret does not hold an error.

David


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2023-12-21 14:10 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-12-21  8:58 [PATCH] afs: remove redundant overwriting of ret Anastasia Belova
2023-12-21 14:10 ` David Howells

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®