Commit c9fd2952 authored by Russell Currey's avatar Russell Currey Committed by Michael Ellerman

powerpc/secvar: Fix incorrect return in secvar_sysfs_load()

secvar_ops->get_next() returns -ENOENT when there are no more variables
to return, which is expected behaviour.

Fix this by returning 0 if get_next() returns -ENOENT.

This fixes an issue introduced in commit bd5d9c74 ("powerpc: expose
secure variables to userspace via sysfs"), but the return code of
secvar_sysfs_load() was never checked so this issue never mattered.
Signed-off-by: default avatarRussell Currey <ruscur@russell.cc>
Signed-off-by: default avatarAndrew Donnellan <ajd@linux.ibm.com>
Reviewed-by: default avatarStefan Berger <stefanb@linux.ibm.com>
Signed-off-by: default avatarMichael Ellerman <mpe@ellerman.id.au>
Link: https://lore.kernel.org/r/20230210080401.345462-4-ajd@linux.ibm.com
parent fcf63d6b
......@@ -179,8 +179,10 @@ static int secvar_sysfs_load(void)
rc = secvar_ops->get_next(name, &namesize, NAME_MAX_SIZE);
if (rc) {
if (rc != -ENOENT)
pr_err("error getting secvar from firmware %d\n",
rc);
pr_err("error getting secvar from firmware %d\n", rc);
else
rc = 0;
break;
}
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment