lkml.org 
[lkml]   [2019]   [Nov]   [11]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH 8/8] Input: input_event: fix struct padding on sparc64
Hi Arnd,

On Fri, Nov 08, 2019 at 09:34:31PM +0100, Arnd Bergmann wrote:
> Going through all uses of timeval, I noticed that we screwed up
> input_event in the previous attempts to fix it:
>
> The time fields now match between kernel and user space, but
> all following fields are in the wrong place.
>
> Add the required padding that is implied by the glibc timeval
> definition to fix the layout, and add explicit initialization
> to avoid leaking kernel stack data.
>
> Cc: sparclinux@vger.kernel.org
> Cc: "David S. Miller" <davem@davemloft.net>
> Cc: stable@vger.kernel.org
> Fixes: 141e5dcaa735 ("Input: input_event - fix the CONFIG_SPARC64 mixup")
> Fixes: 2e746942ebac ("Input: input_event - provide override for sparc64")
> Signed-off-by: Arnd Bergmann <arnd@arndb.de>
> ---
> drivers/input/evdev.c | 3 +++
> drivers/input/misc/uinput.c | 3 +++
> include/uapi/linux/input.h | 1 +
> 3 files changed, 7 insertions(+)
>
> diff --git a/drivers/input/evdev.c b/drivers/input/evdev.c
> index d7dd6fcf2db0..24a90793caf0 100644
> --- a/drivers/input/evdev.c
> +++ b/drivers/input/evdev.c
> @@ -228,6 +228,9 @@ static void __pass_event(struct evdev_client *client,
> event->input_event_sec;
> client->buffer[client->tail].input_event_usec =
> event->input_event_usec;
> +#ifdef CONFIG_SPARC64
> + client->buffer[client->tail].__pad = 0;
> +#endif
> client->buffer[client->tail].type = EV_SYN;
> client->buffer[client->tail].code = SYN_DROPPED;
> client->buffer[client->tail].value = 0;

I do not like ifdefs here, do you think we could write:

client->buffer[client->tail] = (struct input_event) {
.input_event_sec = event->input_event_sec,
.input_event_usec = event->input_event_usec,
.type = EV_SYN,
.code = SYN_DROPPED,
};

to ensure all padded fields are initialized? This is not hot path as we
do not expect queue to overfill too often.

Thanks.

--
Dmitry

\
 
 \ /
  Last update: 2019-11-11 19:28    [W:0.147 / U:2.788 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site