Skip to content

Commit cb8f63b

Browse files
Gabriel Knezekbrgl
authored andcommitted
gpiolib: cdev: zero padding during conversion to gpioline_info_changed
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: aad9558 ("gpiolib: cdev: support GPIO_V2_GET_LINEINFO_IOCTL and GPIO_V2_GET_LINEINFO_WATCH_IOCTL") Signed-off-by: Gabriel Knezek <[email protected]> Reviewed-by: Kent Gibson <[email protected]> Signed-off-by: Bartosz Golaszewski <[email protected]>
1 parent 3093e6c commit cb8f63b

File tree

1 file changed

+1
-0
lines changed

1 file changed

+1
-0
lines changed

drivers/gpio/gpiolib-cdev.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1880,6 +1880,7 @@ static void gpio_v2_line_info_changed_to_v1(
18801880
struct gpio_v2_line_info_changed *lic_v2,
18811881
struct gpioline_info_changed *lic_v1)
18821882
{
1883+
memset(lic_v1, 0, sizeof(*lic_v1));
18831884
gpio_v2_line_info_to_v1(&lic_v2->info, &lic_v1->info);
18841885
lic_v1->timestamp = lic_v2->timestamp_ns;
18851886
lic_v1->event_type = lic_v2->event_type;

0 commit comments

Comments
 (0)