From ec90223ed8fd3c7e08791b62aaecf6d8b84a7230 Mon Sep 17 00:00:00 2001 From: Mikael Olsson Date: Thu, 24 Aug 2023 13:28:19 +0200 Subject: Initialize UAPI structs copied to user space To not leak any information from kernel space when IOCTL calls copy data from kernel space to user space, the source struct in the IOCTL calls is now initialized. Change-Id: I0825e82ccdb51ced747e160dd7385fa1ed227eaf Signed-off-by: Mikael Olsson --- kernel/ethosu_buffer.c | 2 +- kernel/ethosu_inference.c | 4 ++-- kernel/ethosu_network.c | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/kernel/ethosu_buffer.c b/kernel/ethosu_buffer.c index e9575e7..7a49b39 100644 --- a/kernel/ethosu_buffer.c +++ b/kernel/ethosu_buffer.c @@ -147,7 +147,7 @@ static long ethosu_buffer_ioctl(struct file *file, break; } case ETHOSU_IOCTL_BUFFER_GET: { - struct ethosu_uapi_buffer uapi; + struct ethosu_uapi_buffer uapi = { 0 }; uapi.size = buf->size; uapi.offset = buf->offset; diff --git a/kernel/ethosu_inference.c b/kernel/ethosu_inference.c index 60ed954..50007d0 100644 --- a/kernel/ethosu_inference.c +++ b/kernel/ethosu_inference.c @@ -220,7 +220,7 @@ static long ethosu_inference_ioctl(struct file *file, switch (cmd) { case ETHOSU_IOCTL_INFERENCE_STATUS: { - struct ethosu_uapi_result_status uapi; + struct ethosu_uapi_result_status uapi = { 0 }; int i; uapi.status = inf->status; @@ -244,7 +244,7 @@ static long ethosu_inference_ioctl(struct file *file, break; } case ETHOSU_IOCTL_INFERENCE_CANCEL: { - struct ethosu_uapi_cancel_inference_status uapi; + struct ethosu_uapi_cancel_inference_status uapi = { 0 }; dev_info(dev, "Inference ioctl: Cancel Inference. Handle=%p\n", diff --git a/kernel/ethosu_network.c b/kernel/ethosu_network.c index 71ae484..dc641c5 100644 --- a/kernel/ethosu_network.c +++ b/kernel/ethosu_network.c @@ -111,7 +111,7 @@ static long ethosu_network_ioctl(struct file *file, switch (cmd) { case ETHOSU_IOCTL_NETWORK_INFO: { - struct ethosu_uapi_network_info uapi; + struct ethosu_uapi_network_info uapi = { 0 }; dev_info(dev, "Network ioctl: Network info. net=0x%pK\n", net); -- cgit v1.2.1