|
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [xen staging] hypfs: add ASSERT_UNREACHABLE() in hypfs_get_entry_rel()
commit 1044a59e8e533a07eed3be37411a0f4a3c26b6fd
Author: Dmytro Prokopchuk <dmytro_prokopchuk1@xxxxxxxx>
AuthorDate: Wed May 13 10:00:05 2026 +0200
Commit: Jan Beulich <jbeulich@xxxxxxxx>
CommitDate: Wed May 13 10:00:05 2026 +0200
hypfs: add ASSERT_UNREACHABLE() in hypfs_get_entry_rel()
The statement 'return ERR_PTR(-ENOENT);' on the final line of the
function 'hypfs_get_entry_rel()' is unreachable because the logic within
the infinite loop 'for (;;)' provides all possible exit paths for the
function. So there is no execution path to exit the loop and reach the
final that statement.
This unreachable code violates MISRA C Rule 2.1 which states: "A project
shall not contain unreachable code".
To fix that and potential compilers "control reaches end of non-void
function" warning, mark the code path as unreachable using macro
'ASSERT_UNREACHABLE()'.
Signed-off-by: Dmytro Prokopchuk <dmytro_prokopchuk1@xxxxxxxx>
Reviewed-by: Juergen Gross <jgross@xxxxxxxx>
---
xen/common/hypfs.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/xen/common/hypfs.c b/xen/common/hypfs.c
index cdf4ee0171..02fb234568 100644
--- a/xen/common/hypfs.c
+++ b/xen/common/hypfs.c
@@ -348,6 +348,7 @@ static struct hypfs_entry *hypfs_get_entry_rel(struct
hypfs_entry_dir *dir,
dir = container_of(entry, struct hypfs_entry_dir, e);
}
+ ASSERT_UNREACHABLE();
return ERR_PTR(-ENOENT);
}
--
generated by git-patchbot for /home/xen/git/xen.git#staging
|
![]() |
Lists.xenproject.org is hosted with RackSpace, monitoring our |