Conversation
|
ⓘ Qodo reviews are paused because the subscription is no longer active. Ask your workspace admin to reactivate the subscription to resume reviews. Manage billing |
PR Summary by QodoHarden four MSP request and telemetry paths
AI Description
Diagram
High-Level Assessment
Files changed (3)
|
Code Review by Qodo
1.
|
MSP_REBOOT and MSP_ACC_CALIBRATION already document their armed refusal; MSP_SET_PASSTHROUGH now does the same. README.md regenerated with gen_msp_md.py.
|
RAM / Flash usage vs. base commit
See RAM/flash optimization guide for techniques to reduce usage. |
|
Test firmware build ready — commit Download firmware for PR #11899 250 targets built. Find your board's
|
Problem
@jFriedli reported four MSP paths on
maintenance-10.xthat mishandle unexpected input: a zero-lengthMSP_SET_PASSTHROUGHenters ESC 4-way mode and disables the motor outputs even while armed (#11777); anMSP_DATAFLASH_READwith a start address beyond the FlashFS volume underflows the length and reaches the flash driver with an oversized read (#11778); a 2-byte MSPv1 start frame over telemetry is accepted although the parser reads a 3-byte header (#11779); and a short final MSP-over-SmartPort response frame carries uninitialised stack bytes (#11780). All four were shown with host-side ASan/MSan harnesses, not on hardware. Fixes #11777, fixes #11778, fixes #11779, fixes #11780.Cause
On
maintenance-10.x:src/main/fc/fc_msp.c:256-260callsesc4wayInit()with noARMING_FLAG(ARMED)check;esc4wayInit()starts withpwmDisableMotors()(src/main/io/serial_4way.c:138). The dispatcher atfc_msp.c:5159-5161always returns ACK.src/main/fc/fc_msp.c:380-383computesflashfsSize - addressbefore checkingaddress < flashfsSize; the unsigned subtraction wraps.src/main/telemetry/msp_shared.c:127-149enforces onlyMIN_LENGTH_CHUNK(2), then readsframeStart[2]and initialises the request sbuf atframeStart + 3.MIN_LENGTH_REQUEST_V1(line 39) is never applied.src/main/telemetry/smartport.c:419-421leavespayloaduninitialised and copies onlydataSizebytes;smartPortWriteFrameSerial()(line 336) sends allsizeof(smartPortPayload_t)bytes.Change
mspFcSetPassthroughCommand()now returnsmspResult_e; the 4-way branch returnsMSP_RESULT_ERRORwhile armed and the dispatcher passes that result through.serializeDataflashReadReply()setsreadLen = 0whenaddress >= flashfsSizeand skipsflashfsReadAbs()for an empty read.handleMspFrame()requiresMIN_LENGTH_REQUEST_V1for an MSPv1 start frame and clearsmspStartedon every start frame and on the short-chunk and version-mismatch exits, so a rejected start frame cannot leave an earlier partial request live.smartPortSendMspResponse()zeroes the payload before filling it.flashfsReadAbs()keeps its own subtraction and is not touched.Test
Not run on hardware or SITL. Cause verified by reading the locations above; each of the reporter's harnesses maps to one of them. No firmware build has run: the upstream "Build firmware" run is blocked awaiting approval with no jobs executed (https://github.com/iNavFlight/inav/actions/runs/34620914526) and the fork has no run for this branch. No test in
src/test/unitcompilesfc_msp.c,msp_shared.corsmartport.c. Qodo's review flagged one issue, stale request state after a rejected short start frame (#11899 (comment)), fixed in ef4bffa. Compiled for all targets and the four SITL builds on the fork, green: https://github.com/Raffi1202/inav/actions/runs/34770665897Flash / RAM
Builds clean on all targets. No size comparison yet: the fork build has no baseline for this branch, and the upstream size report runs once CI is released for this PR.
Docs
docs/development/msp/msp_messages.json:MSP_SET_PASSTHROUGHnow documents that ESC 4-way is refused while armed, the wayMSP_REBOOTandMSP_ACC_CALIBRATIONalready do.README.mdregenerated withgen_msp_md.py.