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

LoRaWAN: Proper size checks for link ADR cmds & correct include path in Unittests framework #9601

Merged
merged 3 commits into from Feb 15, 2019

Conversation

Projects
None yet
8 participants
@hasnainvirk
Copy link
Contributor

hasnainvirk commented Feb 4, 2019

Description

This PR addresses two issues:

i) adr_settings construct of type link_adr_params_t in link_adr_request() API in the LoRaPHYUS915 class would be render uninitialized if the program takes a specific branch path. We have fixed that by zero initializing the construct. In addition to that we are now checking for the proper payload size anticipating contiguous link ADR command blocks.

ii) Currently, mbed Unittests will fail to run memcheck tool or other tools as the DartConfiguration.Tcl file would not be found. The problem is the inclusion of Ctest framework at the wrong place. We need explicit inclusion in the CmakeLists.txt which fixes the issue,

Pull request type

[X] Fix
[ ] Refactor
[ ] Target update
[ ] Functionality change
[ ] Docs update
[ ] Test update
[ ] Breaking change

Reviewers

@AnttiKauppila
@kjbracey-arm
@cmonr

@hasnainvirk hasnainvirk changed the title Fixing initialization of link_adr_params_t in link_adr_request() API & correct include path in Unittests framework [LoRaWAN] Fixing initialization of link_adr_params_t in link_adr_request() API & correct include path in Unittests framework Feb 4, 2019

@ciarmcom ciarmcom requested review from AnttiKauppila , cmonr , kjbracey-arm and ARMmbed/mbed-os-maintainers Feb 4, 2019

@ciarmcom

This comment has been minimized.

Copy link
Member

ciarmcom commented Feb 4, 2019

@hasnainvirk hasnainvirk force-pushed the hasnainvirk:mem_leak_link_adr branch Feb 4, 2019

@hasnainvirk hasnainvirk changed the title [LoRaWAN] Fixing initialization of link_adr_params_t in link_adr_request() API & correct include path in Unittests framework [LoRaWAN] Proper size checks for link ADR cmds & correct include path in Unittests framework Feb 4, 2019

@hasnainvirk hasnainvirk force-pushed the hasnainvirk:mem_leak_link_adr branch Feb 4, 2019

@hasnainvirk

This comment has been minimized.

Copy link
Contributor Author

hasnainvirk commented Feb 5, 2019

@cmonr We may need to trigger build again. The failure seems to be unrelated to PR.

@NirSonnenschein

This comment has been minimized.

Copy link
Contributor

NirSonnenschein commented Feb 5, 2019

Hi @hasnainvirk ,
@cmonr is not available right now: restarting CI

Show resolved Hide resolved features/lorawan/lorastack/phy/LoRaPHYCN470.cpp Outdated
Show resolved Hide resolved features/lorawan/lorastack/phy/LoRaPHYUS915.cpp Outdated
@mbed-ci

This comment has been minimized.

Copy link

mbed-ci commented Feb 5, 2019

Test run: SUCCESS

Summary: 12 of 12 test jobs passed
Build number : 1
Build artifacts

@hasnainvirk hasnainvirk force-pushed the hasnainvirk:mem_leak_link_adr branch Feb 5, 2019

@hasnainvirk

This comment has been minimized.

Copy link
Contributor Author

hasnainvirk commented Feb 5, 2019

@kjbracey-arm Please review again.

@hasnainvirk

This comment has been minimized.

Copy link
Contributor Author

hasnainvirk commented Feb 7, 2019

@0xc0170 @NirSonnenschein This can go in too.

@0xc0170 0xc0170 changed the title [LoRaWAN] Proper size checks for link ADR cmds & correct include path in Unittests framework LoRaWAN: Proper size checks for link ADR cmds & correct include path in Unittests framework Feb 7, 2019

@0xc0170

This comment has been minimized.

Copy link
Member

0xc0170 commented Feb 7, 2019

No reviews from @mbed-os-wan ? At least one here!

@0xc0170

0xc0170 approved these changes Feb 7, 2019

@hasnainvirk

This comment has been minimized.

Copy link
Contributor Author

hasnainvirk commented Feb 8, 2019

@0xc0170 Antti is OOO. The other LoRaWAN option in mbed-os-wan is me and I opened this PR :)

@cmonr
Copy link
Contributor

cmonr left a comment

Will OK once the typo is fixed

Show resolved Hide resolved features/lorawan/lorastack/mac/LoRaMacCommand.cpp Outdated

@cmonr cmonr added needs: work and removed needs: review labels Feb 11, 2019

hasnainvirk added some commits Feb 4, 2019

Including CTest explicitly
enable_test() seems to include CTest framework in the CMakeLists.txt but
that would result in inconsistencies and CTest framework will not be
able to find DartConfiguration file or MemCheck tool.

Including CTest framework explicitely in the CMakeLists.txt seems to
solve the issue.
Proper size checking for link ADR commands
In a specific branch path 'adr_settings' in link_adr_request() API, the
structure adr_settings of type link_adr_params_t will be rendered
uninitialized. To prevent this we initialize the construct as zero.
In addition to that, to handle the case properly we should check for the
command identifier and the command payload length anticipating contiguous
blocks of adr commands. If we find a discrepency in size, we should
abort.
Updating unit tests
Updating unit test in response to the change in the link ADR related
APIs.

@hasnainvirk hasnainvirk force-pushed the hasnainvirk:mem_leak_link_adr branch to a14acfa Feb 14, 2019

@hasnainvirk

This comment has been minimized.

Copy link
Contributor Author

hasnainvirk commented Feb 14, 2019

@cmonr Updated as suggested. Thanks for a having splendid pair of eyes :)

@cmonr

cmonr approved these changes Feb 15, 2019

@cmonr

This comment has been minimized.

Copy link
Contributor

cmonr commented Feb 15, 2019

CI started

@mbed-ci

This comment has been minimized.

Copy link

mbed-ci commented Feb 15, 2019

Test run: SUCCESS

Summary: 12 of 12 test jobs passed
Build number : 2
Build artifacts

@0xc0170 0xc0170 added ready for merge and removed needs: CI labels Feb 15, 2019

@0xc0170 0xc0170 merged commit dc15744 into ARMmbed:master Feb 15, 2019

27 checks passed

continuous-integration/jenkins/pr-head This commit looks good
Details
continuous-integration/travis-ci/pr The Travis CI build passed
Details
jenkins-ci/build-ARM Success
Details
jenkins-ci/build-ARMC6 Success
Details
jenkins-ci/build-GCC_ARM Success
Details
jenkins-ci/build-IAR Success
Details
jenkins-ci/cloud-client-test Success
Details
jenkins-ci/dynamic-memory-usage RTOS ROM(+0 bytes) RAM(-48 bytes)
Details
jenkins-ci/exporter Success
Details
jenkins-ci/greentea-test Success
Details
jenkins-ci/mbed2-build-ARM Success
Details
jenkins-ci/mbed2-build-GCC_ARM Success
Details
jenkins-ci/mbed2-build-IAR Success
Details
jenkins-ci/unittests Success
Details
travis-ci/astyle Local astyle testing has passed
Details
travis-ci/docs Local docs testing has passed
Details
travis-ci/doxy-spellcheck Local doxy-spellcheck testing has passed
Details
travis-ci/events Passed, runtime is 9294 cycles (-1224 cycles)
Details
travis-ci/gitattributestest Local gitattributestest testing has passed
Details
travis-ci/include_check Local include_check testing has passed
Details
travis-ci/licence_check Local licence_check testing has passed
Details
travis-ci/littlefs Passed, code size is 8408B (+0.00%)
Details
travis-ci/psa-autogen Local psa-autogen testing has passed
Details
travis-ci/tools-py2.7 Local tools-py2.7 testing has passed
Details
travis-ci/tools-py3.5 Local tools-py3.5 testing has passed
Details
travis-ci/tools-py3.6 Local tools-py3.6 testing has passed
Details
travis-ci/tools-py3.7 Local tools-py3.7 testing has passed
Details
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.