-
Notifications
You must be signed in to change notification settings - Fork 8.2k
Closed
Labels
bugThe issue is a bug, or the PR is fixing a bugThe issue is a bug, or the PR is fixing a bugpriority: lowLow impact/importance bugLow impact/importance bug
Milestone
Description
Describe the bug
Drivers have option to not implement erase, in which case pointer to erase callback may be left NULL:
zephyr/include/zephyr/drivers/flash.h
Lines 309 to 312 in c14b022
| static inline int z_impl_flash_erase(const struct device *dev, off_t offset, | |
| size_t size) | |
| { | |
| int rc = -ENOSYS; |
But handler for the erase has been left as it is always expected:
zephyr/drivers/flash/flash_handlers.c
Line 34 in c14b022
| K_OOPS(K_SYSCALL_DRIVER_FLASH(dev, erase)); |
Expected behavior
Proper check should be done using K_SYSCALL_OBJ, to only verify the object, ignoring whether erase callback is assigned or not.
K_OOPS(K_SYSCALL_OBJ(dev, K_OBJ_DRIVER_FLASH))
Impact
Currently only on out-of-tree drivers that do not implement erase.
Environment (please complete the following information):
- OS: Ubuntu 20
- Toolchain Zephyr sdk 0.17.0
- Commit SHA c14b022
Additional context
Verification Return Value Policies
K_SYSCALL_OBJ
K_SYSCALL_DRIVER_OP
Metadata
Metadata
Assignees
Labels
bugThe issue is a bug, or the PR is fixing a bugThe issue is a bug, or the PR is fixing a bugpriority: lowLow impact/importance bugLow impact/importance bug