[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Minios-devel] [UNIKRAFT VFS PATCH v2 3/4] Add asserts to fdrop()



We are adding the asserts to be consistent with other
reference releasing functions: drele, vrele.

Signed-off-by: Mihai Pogonaru <pogonarumihai@xxxxxxxxx>
---
 lib/vfscore/file.c | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/lib/vfscore/file.c b/lib/vfscore/file.c
index e7627e96..bc8b0dc8 100644
--- a/lib/vfscore/file.c
+++ b/lib/vfscore/file.c
@@ -42,7 +42,12 @@
 
 int fdrop(struct vfscore_file *fp)
 {
-       int prev = ukarch_dec(&fp->f_count);
+       int prev;
+
+       UK_ASSERT(fp);
+       UK_ASSERT(fp->f_count > 0);
+
+       prev = ukarch_dec(&fp->f_count);
 
        if (prev == 0)
                UK_CRASH("Unbalanced fhold/fdrop");
-- 
2.11.0


_______________________________________________
Minios-devel mailing list
Minios-devel@xxxxxxxxxxxxxxxxxxxx
https://lists.xenproject.org/mailman/listinfo/minios-devel

 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.