[PATCH] afs: remove redundant overwriting of ret

Anastasia Belova posted 1 patch 2 years, 1 month ago
fs/afs/cell.c | 1 -
1 file changed, 1 deletion(-)
[PATCH] afs: remove redundant overwriting of ret
Posted by Anastasia Belova 2 years, 1 month ago
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
Re: [PATCH] afs: remove redundant overwriting of ret
Posted by David Howells 2 years, 1 month ago
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