aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMikael Olsson <mikael.olsson@arm.com>2023-08-24 13:28:19 +0200
committerMikael Olsson <mikael.olsson@arm.com>2023-09-07 10:42:29 +0200
commitec90223ed8fd3c7e08791b62aaecf6d8b84a7230 (patch)
tree3d83b757171773d3416616821b8d28e335bc5c95
parent52c563d3928077c7e50fd121162709facf20214b (diff)
downloadethos-u-linux-driver-stack-ec90223ed8fd3c7e08791b62aaecf6d8b84a7230.tar.gz
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 <mikael.olsson@arm.com>
-rw-r--r--kernel/ethosu_buffer.c2
-rw-r--r--kernel/ethosu_inference.c4
-rw-r--r--kernel/ethosu_network.c2
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);