diff options
Diffstat (limited to 'modules/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 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; } |