Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

l2m2m: writing to ressources with pre_write callback fails #30541

Closed
huelsenfruchtzwerg opened this issue Dec 9, 2020 · 0 comments · Fixed by #30542
Closed

l2m2m: writing to ressources with pre_write callback fails #30541

huelsenfruchtzwerg opened this issue Dec 9, 2020 · 0 comments · Fixed by #30542
Assignees
Labels
bug The issue is a bug, or the PR is fixing a bug

Comments

@huelsenfruchtzwerg
Copy link
Contributor

huelsenfruchtzwerg commented Dec 9, 2020

Describe the bug
Writing to ressources which have a pre_write callback registered that can return a buffer thats longer than the original ressource buffers size may fail with -EINVAL.

To Reproduce

Try to write a value to e.g. "3/0/13" (device time).
assert(!lwm2m_engine_set_s32("3/0/13", 1607477126)

This will fail with -EINVAL.

Expected behavior
The value should've been written to the temporary buffer returned by "3/0/13"s pre_write callback (registered in lwm2m_obj_device.c) and used to update the device's UTC-offset.

Impact
Setting time externaly via lwm2m is impossible.
This also makes it hard/impossible to create ressources that use an external buffer/mechanism to store the values, e.g. to save on memory footprint.

Environment (please complete the following information):

  • OS: Linux
  • Toolchain: Zephyr SDK 0.11.4
  • Commit SHA or Version used: 105a1b9 (from nordics zephyr fork)
@huelsenfruchtzwerg huelsenfruchtzwerg added the bug The issue is a bug, or the PR is fixing a bug label Dec 9, 2020
huelsenfruchtzwerg added a commit to huelsenfruchtzwerg/zephyr that referenced this issue Dec 9, 2020
Previously, lwm2m_engine set would check against the max_data_len
parameter of the ressource, but didn't take into consideration the
(possibly changed) max_data_len returned by the pre_write callback.

Fixes zephyrproject-rtos#30541

Signed-off-by: Henning Fleddermann <henning.fleddermann@grandcentrix.net>
@rlubos rlubos self-assigned this Dec 9, 2020
jukkar pushed a commit that referenced this issue Dec 9, 2020
Previously, lwm2m_engine set would check against the max_data_len
parameter of the ressource, but didn't take into consideration the
(possibly changed) max_data_len returned by the pre_write callback.

Fixes #30541

Signed-off-by: Henning Fleddermann <henning.fleddermann@grandcentrix.net>
bwasim pushed a commit to bwasim/zephyr that referenced this issue Jan 5, 2021
Previously, lwm2m_engine set would check against the max_data_len
parameter of the ressource, but didn't take into consideration the
(possibly changed) max_data_len returned by the pre_write callback.

Fixes zephyrproject-rtos#30541

Signed-off-by: Henning Fleddermann <henning.fleddermann@grandcentrix.net>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug The issue is a bug, or the PR is fixing a bug
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants