Re: [PATCH] ANDROID: binder: Add BINDER_GET_NODE_INFO_FOR_REF ioctl.

From: Dan Carpenter
Date: Wed Sep 05 2018 - 05:09:44 EST


On Wed, Sep 05, 2018 at 09:33:46AM +0200, Martijn Coenen wrote:
> diff --git a/include/uapi/linux/android/binder.h b/include/uapi/linux/android/binder.h
> index bfaec6903b8bc..a54a680ff2936 100644
> --- a/include/uapi/linux/android/binder.h
> +++ b/include/uapi/linux/android/binder.h
> @@ -200,6 +200,13 @@ struct binder_node_debug_info {
> __u32 has_weak_ref;
> };
>
> +struct binder_node_info_for_ref {
> + __u32 handle;
> + __u32 strong_count;
> + __u32 weak_count;
> + __u64 reserved;
> +};

What's the reserved for? On 64 bit systems there is a 4 byte struct
hole between weak_count and reserved. Why not just make reserved a
__u32 and get rid of the hole? (Not rhetorical, I have no idea).

Btw, people sometimes complain about that we don't check that user input
is zeroed in ioctls. Like for example maybe they're passing random data
in the the strong_count field and then later we decide that actually
that field should mean something but we can't make it mean anything
because we've been letting the user put whatever they want there. These
are just random thoughts in my head, not necessarily important.

regards,
dan carpenter