Merge "libgralloc: Add support for custom buffer size."
diff --git a/libgralloc/gpu.cpp b/libgralloc/gpu.cpp
index 7b2c1d8..f11a5fe 100644
--- a/libgralloc/gpu.cpp
+++ b/libgralloc/gpu.cpp
@@ -44,6 +44,7 @@
     common.module  = const_cast<hw_module_t*>(&module->base.common);
     common.close   = gralloc_close;
     alloc          = gralloc_alloc;
+    allocSize      = gralloc_alloc_size;
     free           = gralloc_free;
 
 }
@@ -236,7 +237,7 @@
 
     if ((ssize_t)size <= 0)
         return -EINVAL;
-    size = (bufferSize >= size)? bufferSize : size;
+    size = (bufferSize != 0)? bufferSize : size;
 
     // All buffers marked as protected or for external
     // display need to go to overlay