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

mgmt: mcumgr: smp: Fix custom payload size #85604

Merged
merged 1 commit into from
Feb 13, 2025
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 9 additions & 3 deletions subsys/mgmt/mcumgr/smp/src/smp.c
Original file line number Diff line number Diff line change
Expand Up @@ -310,9 +310,15 @@ static int smp_handle_single_req(struct smp_streamer *streamer, const struct smp
}
#endif

smp_make_rsp_hdr(req_hdr, &rsp_hdr,
zsp->payload_mut - nbw->nb->data - MGMT_HDR_SIZE);
nbw->nb->len = zsp->payload_mut - nbw->nb->data;
#if defined(CONFIG_MCUMGR_MGMT_CUSTOM_PAYLOAD)
if (!mgmt_find_group(req_hdr->nh_group)->custom_payload) {
#endif
nbw->nb->len = zsp->payload_mut - nbw->nb->data;
#if defined(CONFIG_MCUMGR_MGMT_CUSTOM_PAYLOAD)
}
#endif
Comment on lines +313 to +319
Copy link
Collaborator

Choose a reason for hiding this comment

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

Not sure if this increases readability

	if (COND_CODE_1(CONFIG_MCUMGR_MGMT_CUSTOM_PAYLOAD,
	    (!mgmt_find_group(req_hdr->nh_group)->custom_payload), (true))) {
		nbw->nb->len = zsp->payload_mut - nbw->nb->data;
	}


smp_make_rsp_hdr(req_hdr, &rsp_hdr, (nbw->nb->len - MGMT_HDR_SIZE));
smp_write_hdr(streamer, &rsp_hdr);

return 0;
Expand Down
Loading