diff options
author | Mathias Agopian <mathias@google.com> | 2009-08-18 17:22:51 -0700 |
---|---|---|
committer | Mathias Agopian <mathias@google.com> | 2009-08-18 17:24:52 -0700 |
commit | 876b4e8b84087ad99f499c064758a2660a990e5c (patch) | |
tree | e501f822dbf9ce224f79c7ea4afd2fbddb1de198 | |
parent | ed04f7871bab3cb07e47e42fe4d9ebe5b02281a2 (diff) | |
download | libhardware-876b4e8b84087ad99f499c064758a2660a990e5c.tar.gz |
integrate this change from the generic gralloc
-rw-r--r-- | modules/gralloc/gralloc_priv.h | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/modules/gralloc/gralloc_priv.h b/modules/gralloc/gralloc_priv.h index bfd3635b..3ab1f54b 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; } |