2023-12-21 09:03:35

by Anastasia Belova

[permalink] [raw]
Subject: [PATCH] afs: remove redundant overwriting of ret

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 <[email protected]>
---
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



2023-12-21 14:26:27

by David Howells

[permalink] [raw]
Subject: Re: [PATCH] afs: remove redundant overwriting of ret

Anastasia Belova <[email protected]> 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