summaryrefslogtreecommitdiffstats
path: root/modules/gralloc
diff options
context:
space:
mode:
authorMathias Agopian <mathias@google.com>2009-08-18 17:22:51 -0700
committerMathias Agopian <mathias@google.com>2009-08-18 17:24:52 -0700
commit876b4e8b84087ad99f499c064758a2660a990e5c (patch)
treee501f822dbf9ce224f79c7ea4afd2fbddb1de198 /modules/gralloc
parented04f7871bab3cb07e47e42fe4d9ebe5b02281a2 (diff)
downloadhardware_libhardware-876b4e8b84087ad99f499c064758a2660a990e5c.zip
hardware_libhardware-876b4e8b84087ad99f499c064758a2660a990e5c.tar.gz
hardware_libhardware-876b4e8b84087ad99f499c064758a2660a990e5c.tar.bz2
integrate this change from the generic gralloc
Diffstat (limited to 'modules/gralloc')
-rw-r--r--modules/gralloc/gralloc_priv.h12
1 files changed, 8 insertions, 4 deletions
diff --git a/modules/gralloc/gralloc_priv.h b/modules/gralloc/gralloc_priv.h
index bfd3635..3ab1f54 100644
--- a/modules/gralloc/gralloc_priv.h
+++ b/modules/gralloc/gralloc_priv.h
@@ -106,11 +106,14 @@ struct private_handle_t : public native_handle
LOCK_STATE_READ_MASK = 0x3FFFFFFF
};
+ // file-descriptors
int fd;
+ // ints
int magic;
int flags;
int size;
int offset;
+
// FIXME: the attributes below should be out-of-line
int base;
int lockState;
@@ -138,13 +141,14 @@ struct private_handle_t : public native_handle
}
static int validate(const native_handle* h) {
+ const private_handle_t* hnd = (const private_handle_t*)h;
if (!h || h->version != sizeof(native_handle) ||
- h->numInts!=sNumInts || h->numFds!=sNumFds) {
+ h->numInts != sNumInts || h->numFds != sNumFds ||
+ hnd->magic != sMagic)
+ {
+ LOGE("invalid gralloc handle (at %p)", h);
return -EINVAL;
}
- const private_handle_t* hnd = (const private_handle_t*)h;
- if (hnd->magic != sMagic)
- return -EINVAL;
return 0;
}