afs: remove redundant overwriting of ret

Message ID 20231221085849.1463-1-abelova@astralinux.ru
State New
Headers
Series afs: remove redundant overwriting of ret |

Commit Message

Anastasia Belova Dec. 21, 2023, 8:58 a.m. UTC
  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(-)
  

Comments

David Howells Dec. 21, 2023, 2:10 p.m. UTC | #1
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
  

Patch

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;