# \[PATCH 1/1\] gpiolib: Zero structure which will be returned to usermode to avoid kernel info leak.

- From: Gabriel Knezek \<hidden\>
- Date: 2021-06-16 21:51:42 
- List: linux-gpio
- Page: https://ratatoskr.run/linux-gpio/2021/06/8513363
- Thread: https://ratatoskr.run/linux-gpio/2021/06/8513363/t.md

```text
Apologies if I got this slightly wrong; this is actually my first time submitting a patch to the kernel. (:

Thanks.
-Gabe

Fixes: aad95584 ("gpiolib: cdev: support GPIO_V2_GET_LINEINFO_IOCTL and GPIO_V2_GET_LINEINFO_WATCH_IOCTL")
Signed-off-by: Gabriel Knezek <redacted>
---
 drivers/gpio/gpiolib-cdev.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/gpio/gpiolib-cdev.c b/drivers/gpio/gpiolib-cdev.c
index ee5903aac497..af68532835fe 100644
--- a/drivers/gpio/gpiolib-cdev.c
+++ b/drivers/gpio/gpiolib-cdev.c
@@ -1865,6 +1865,7 @@ static void gpio_v2_line_info_changed_to_v1(
                struct gpio_v2_line_info_changed *lic_v2,
                struct gpioline_info_changed *lic_v1)
 {
+       memset(lic_v1, 0, sizeof(*lic_v1));
        gpio_v2_line_info_to_v1(&lic_v2->info, &lic_v1->info);
        lic_v1->timestamp = lic_v2->timestamp_ns;
        lic_v1->event_type = lic_v2->event_type;
--
2.25.1
```
