FSService: Initialise WriteResponse::status on all paths - #2457
#2457Open
JoeStrout wants to merge 1 commit into
InfiniTimeOrg:mainInfiniTimeOrg/InfiniTime:mainfrom
JoeStrout:fix-fsservice-write-statusJoeStrout/InfiniTime:fix-fsservice-write-statusCopy head branch name to clipboard
Open
FSService: Initialise WriteResponse::status on all paths#2457JoeStrout wants to merge 1 commit intoInfiniTimeOrg:mainInfiniTimeOrg/InfiniTime:mainfrom JoeStrout:fix-fsservice-write-statusJoeStrout/InfiniTime:fix-fsservice-write-statusCopy head branch name to clipboard
JoeStrout wants to merge 1 commit into
InfiniTimeOrg:mainInfiniTimeOrg/InfiniTime:mainfrom
JoeStrout:fix-fsservice-write-statusJoeStrout/InfiniTime:fix-fsservice-write-statusCopy head branch name to clipboard
Conversation
WriteResponse has no default member initialisers and both write handlers assigned status on only one branch, so the other returned uninitialised stack memory to the client over BLE: - commands::WRITE assigned status only on success, so a failed FileOpen reported garbage. The ternary was also dead code, as res is known to be 0 inside that branch. - commands::WRITE_DATA assigned status only on failure, so every successful chunk reported garbage, which readily looks like a negative LittleFS error code. Value-initialise both, matching DelResponse, MKDirResponse and ListDirResponse in the same file, and assign status on both paths. The visible symptom is a companion app reporting a file transfer error against a watch that is writing the file correctly.
|
Build size and comparison to main:
|
Author
|
Note: |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
WriteResponse has no default member initialisers and both write handlers assigned status on only one branch, so the other returned uninitialised stack memory to the client over BLE:
This change value-initialises both, matching DelResponse, MKDirResponse and ListDirResponse in the same file, and assign status on both paths.
The visible symptom is a companion app (like InfiniTimeExplorer) reporting a file transfer error ("Error creating file [0]") even when writing the file correctly.