This is an automated email from the ASF dual-hosted git repository. sjanc pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/mynewt-mcumgr.git
commit bc5c979337088e89ef5611cde814a326c91eb0d5 Author: Szymon Janc <[email protected]> AuthorDate: Wed Oct 7 16:10:48 2026 +0200 cmd/img_mgmt: Fix uninitialized upload status Upload status passed to event callback was uninitialized if upload was rejected by application. Initialize it to new 'none' status value. Assisted-by: Claude:claude-opus-5-5 --- cmd/img_mgmt/include/img_mgmt/img_mgmt.h | 2 ++ cmd/img_mgmt/src/img_mgmt.c | 4 +++- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/cmd/img_mgmt/include/img_mgmt/img_mgmt.h b/cmd/img_mgmt/include/img_mgmt/img_mgmt.h index 344681d..d76d2f6 100644 --- a/cmd/img_mgmt/include/img_mgmt/img_mgmt.h +++ b/cmd/img_mgmt/include/img_mgmt/img_mgmt.h @@ -68,6 +68,8 @@ extern "C" { #define IMG_MGMT_ID_UPLOAD_STATUS_START 0 #define IMG_MGMT_ID_UPLOAD_STATUS_ONGOING 1 #define IMG_MGMT_ID_UPLOAD_STATUS_COMPLETE 2 +/** No status determined (e.g., request rejected before processing). */ +#define IMG_MGMT_ID_UPLOAD_STATUS_NONE (-1) extern struct img_mgmt_state g_img_mgmt_state; diff --git a/cmd/img_mgmt/src/img_mgmt.c b/cmd/img_mgmt/src/img_mgmt.c index d582dbd..65ae992 100644 --- a/cmd/img_mgmt/src/img_mgmt.c +++ b/cmd/img_mgmt/src/img_mgmt.c @@ -393,7 +393,9 @@ img_mgmt_upload_log(bool is_first, bool is_last, int status) static int img_mgmt_upload(struct mgmt_ctxt *ctxt) { - struct mgmt_evt_op_cmd_status_arg cmd_status_arg; + struct mgmt_evt_op_cmd_status_arg cmd_status_arg = { + .status = IMG_MGMT_ID_UPLOAD_STATUS_NONE, + }; struct img_mgmt_upload_req req = { .off = -1, .size = -1,
