Skip to content

Conversation

@keith-packard
Copy link
Contributor

Here's a selection of trivial fixes, mostly in sample and test code, that clean up some improper API usage and make the code more compatible with the C standard library. The only change in the core OS is in the img_mgmt subsystem to add
an additional header reference.

@github-actions github-actions bot added area: Kernel area: Samples Samples area: Tests Issues related to a particular existing or missing test labels May 13, 2022
Copy link
Member

@dcpleung dcpleung left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, just one nit.

de-nordic
de-nordic previously approved these changes May 13, 2022
Copy link
Contributor

@de-nordic de-nordic left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

mgmt/mcumgr/lib subsystem looks OK.

andyross
andyross previously approved these changes May 13, 2022
Copy link
Contributor

@andyross andyross left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A digression about one of the fixes, but everything looks fine to me.

dcpleung
dcpleung previously approved these changes May 13, 2022
@keith-packard keith-packard dismissed stale reviews from dcpleung, andyross, and de-nordic via e317a20 May 13, 2022 20:49
@stephanosio stephanosio requested a review from dcpleung May 17, 2022 02:42
nordicjm
nordicjm previously approved these changes May 18, 2022
Copy link
Contributor

@nordicjm nordicjm left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

mcumgr changes approved

de-nordic
de-nordic previously approved these changes May 18, 2022
Copy link
Contributor

@de-nordic de-nordic left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

mcumgr ok.

ceolin
ceolin previously approved these changes May 19, 2022
stephanosio
stephanosio previously approved these changes May 19, 2022
@stephanosio stephanosio requested a review from carlescufi May 19, 2022 13:19
@stephanosio stephanosio assigned de-nordic and unassigned de-nordic May 19, 2022
@stephanosio stephanosio added this to the v3.1.0 milestone May 19, 2022
andyross
andyross previously approved these changes May 19, 2022
Copy link
Contributor

@andyross andyross left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

refresh +1

Somehow two files in subsys/mgmt/mcumgr/lib/cmd/img_mgmt/src ended up
using STRINGIFY but nothing in their include path ended up pulling in
zephyr/toolchain/common.h. Include that via zephyr/toolchain.h.

v2:
	Use non-internal zephyr/toolchain.h header

Signed-off-by: Keith Packard <[email protected]>
The initialized test buffers tx_data and tx2_data were not given a
specific size, but were initialized with one more byte than the
uninitialized buffers they get copied to. As a result, the memcpy found
a buffer overflow. Fix this by setting the source buffer sizes to match
the destination.

Signed-off-by: Keith Packard <[email protected]>
This ensures that we have a definition of z_errno in case
that isn't pulled in with errno.h

Signed-off-by: Keith Packard <[email protected]>
We need to keep gcc from complaining about large calloc/malloc/realloc
sizes as that's what we're testing.

Define _BSD_SOURCE so that libraries sharing the glibc convention (like
newlib and picolibc) for controlling the API level visible to applications
will declare reallocarray(3), which is an OpenBSD extension to the C
library.

Signed-off-by: Keith Packard <[email protected]>
qsort_r is a GNU addition, so we need to #define _GNU_SOURCE to ensure
the prototype is defined in the header file.

Signed-off-by: Keith Packard <[email protected]>
off_t is often unsigned long, which means printf needs to use %lx. Insert
a cast in case the value is unsigned int.

Signed-off-by: Keith Packard <[email protected]>
@mbolivar-nordic
Copy link
Contributor

Rebased in the GitHub UI to try to get clean CI without removing all the +1s

@mbolivar-nordic mbolivar-nordic merged commit d1dc3e8 into zephyrproject-rtos:main May 27, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area: C Library C Standard Library area: Kernel area: mcumgr area: Samples Samples area: SPI SPI bus area: Tests Issues related to a particular existing or missing test

Projects

None yet

Development

Successfully merging this pull request may close these issues.

10 participants