-
Notifications
You must be signed in to change notification settings - Fork 3k
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
storage: fix potential memory corruption and check return values #11269
Conversation
@michalpasztamobica, thank you for your changes. |
What was the coverity warning for 2484? |
@@ -936,7 +936,10 @@ int SPIFBlockDevice::_reset_flash_mem() | |||
tr_error("Sending RST failed"); | |||
status = -1; | |||
} | |||
_is_mem_ready(); | |||
if (false == _is_mem_ready()) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Style barf (backwards and silly boolean comparison instead of just !
), but I guess it's consistent with other code nearby.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Coverity has this nice section which I used to just keep the code consistent:
Examples where return value from this function is checked
--
A1 example_checked | SPIFBlockDevice.cpp:982
B1 example_checked | SPIFBlockDevice.cpp:182
C1 example_checked | SPIFBlockDevice.cpp:410
D1 example_checked | SPIFBlockDevice.cpp:324
|
Hmm, that's just nonsense, isn't it? It's generating a warning about some sort of comparison it's generated internally while inspecting an initialiser. Weird. Still, modified version is neater. |
@kjbracey-arm , I agree and I also consulted three other colleagues who had the same opinion. @JuhPuur came up with this work around we have under review here. I think it would make sense to report this to Coverity developers for further clarification. Maybe we are missing something here? @OPpuolitaival, would you advise us if this reasonable and how to go about this? |
Change is a noop for littlefs 👍 I couldn't make heads or tails of the Coverity warning. The modified version is neater but can only be used in initialization blocks. There's a lot of pair updates in the code where you can use this shortcut which is why |
Ci started meanwhile reviews needed (storage team) (I triggered 2 jobs, not certain how but one I aborted just now) |
Test run: SUCCESSSummary: 11 of 11 test jobs passed |
Description
The change in l. 2484 of lfs.c is not really a fix, as we can't see anything wrong with that line, but it will silence the Coverity tool warning (thanks, @JuhPuur ).
The two other changes are true code improvements.
Pull request type
Reviewers
@SeppoTakalo
@VeijoPesonen
@geky
Release Notes