gpiolib: cdev: zero padding during conversion to gpioline_info_changed
authorGabriel Knezek <gabeknez@linux.microsoft.com>
Mon, 21 Jun 2021 22:28:59 +0000 (15:28 -0700)
committerSasha Levin <sashal@kernel.org>
Wed, 30 Jun 2021 12:47:24 +0000 (08:47 -0400)
commitb9e6c20d4c9d337742d5944aec6cee1e2c277d8c
treeab0b538284a999b804589d9b1ff951c98707df3a
parent0221a5a4db46bcfd797edd92036028db2879c06c
gpiolib: cdev: zero padding during conversion to gpioline_info_changed

[ Upstream commit cb8f63b8cbf39845244f3ccae43bb7e63bd70543 ]

When userspace requests a GPIO v1 line info changed event,
lineinfo_watch_read() populates and returns the gpioline_info_changed
structure. It contains 5 words of padding at the end which are not
initialized before being returned to userspace.

Zero the structure in gpio_v2_line_info_change_to_v1() before populating
its contents.

Fixes: aad955842d1c ("gpiolib: cdev: support GPIO_V2_GET_LINEINFO_IOCTL and GPIO_V2_GET_LINEINFO_WATCH_IOCTL")
Signed-off-by: Gabriel Knezek <gabeknez@linux.microsoft.com>
Reviewed-by: Kent Gibson <warthog618@gmail.com>
Signed-off-by: Bartosz Golaszewski <bgolaszewski@baylibre.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
drivers/gpio/gpiolib-cdev.c