drivers: can: handlers: verify API call in z_vrfy_can_get_state()

Verify the get_state API call in z_vrfy_can_get_state(). Adjust sizeof()
arguments to match the rest of the file.

Signed-off-by: Henrik Brix Andersen <hebad@vestas.com>
This commit is contained in:
Henrik Brix Andersen 2022-03-31 19:21:19 +02:00 committed by Maureen Helm
commit e1290bedeb

View file

@ -143,18 +143,17 @@ static inline void z_vrfy_can_remove_rx_filter(const struct device *dev, int fil
}
#include <syscalls/can_remove_rx_filter_mrsh.c>
static inline
int z_vrfy_can_get_state(const struct device *dev, enum can_state *state,
struct can_bus_err_cnt *err_cnt)
static inline int z_vrfy_can_get_state(const struct device *dev, enum can_state *state,
struct can_bus_err_cnt *err_cnt)
{
Z_OOPS(Z_SYSCALL_OBJ(dev, K_OBJ_DRIVER_CAN));
Z_OOPS(Z_SYSCALL_DRIVER_CAN(dev, get_state));
if (state != NULL) {
Z_OOPS(Z_SYSCALL_MEMORY_WRITE(state, sizeof(enum can_state)));
Z_OOPS(Z_SYSCALL_MEMORY_WRITE(state, sizeof(*state)));
}
if (err_cnt != NULL) {
Z_OOPS(Z_SYSCALL_MEMORY_WRITE(err_cnt, sizeof(struct can_bus_err_cnt)));
Z_OOPS(Z_SYSCALL_MEMORY_WRITE(err_cnt, sizeof(*err_cnt)));
}
return z_impl_can_get_state(dev, state, err_cnt);