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

[PATCH] ASSERT Cache method parameters



ASSERT the Cache public interface methods are passed valid parameters.

Signed-off-by: Owen Smith <owen.smith@xxxxxxxxx>
---
 src/xenbus/cache.c | 15 +++++++++++++++
 1 file changed, 15 insertions(+)

diff --git a/src/xenbus/cache.c b/src/xenbus/cache.c
index 00e16f6..6229aed 100644
--- a/src/xenbus/cache.c
+++ b/src/xenbus/cache.c
@@ -602,6 +602,8 @@ CacheGet(
 
     UNREFERENCED_PARAMETER(Interface);
 
+    ASSERT(Cache != NULL);
+
     KeRaiseIrql(DISPATCH_LEVEL, &Irql);
     Index = KeGetCurrentProcessorNumberEx(NULL);
 
@@ -678,6 +680,9 @@ CachePut(
 
     UNREFERENCED_PARAMETER(Interface);
 
+    ASSERT(Cache != NULL);
+    ASSERT(Object != NULL);
+
     KeRaiseIrql(DISPATCH_LEVEL, &Irql);
     Index = KeGetCurrentProcessorNumberEx(NULL);
 
@@ -837,6 +842,14 @@ CacheCreate(
     KIRQL                   Irql;
     NTSTATUS                status;
 
+    ASSERT(Name != NULL);
+    ASSERT(Size != 0);
+    ASSERT(Ctor != NULL);
+    ASSERT(Dtor != NULL);
+    ASSERT(AcquireLock != NULL);
+    ASSERT(ReleaseLock != NULL);
+    ASSERT(Cache != NULL);
+
     Trace("====> (%s)\n", Name);
 
     *Cache = __CacheAllocate(sizeof (XENBUS_CACHE));
@@ -968,6 +981,8 @@ CacheDestroy(
     PXENBUS_CACHE_CONTEXT   Context = Interface->Context;
     KIRQL                   Irql;
 
+    ASSERT(Cache != NULL);
+
     Trace("====> (%s)\n", Cache->Name);
 
     KeAcquireSpinLock(&Context->Lock, &Irql);
-- 
2.41.0.windows.1




 


Rackspace

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