[riot-notifications] [RIOT-OS/RIOT] socket_zep: fix undefined timestamp conversion behavior (#10858)

Martine Lenders notifications at github.com
Thu Jan 24 14:13:35 CET 2019

The RIOT community cares a lot about code quality.
Therefore, before describing what your contribution is about, we would like
you to make sure that your modifications are compliant with the RIOT
coding conventions, see https://github.com/RIOT-OS/RIOT/wiki/Coding-conventions.

### Contribution description
When I tested #10782 with `gnrc_networking` on `native` I found this issue in `socket_zep`
Put here the description of your contribution:
- describe which part(s) of RIOT is (are) involved
- if it's a bug fix, describe the bug that it solves and how it is solved
- you can also give more information to reviewers about how to test your changes

### Testing procedure
Replace `gnrc_netdev_default` with `socket_zep` in `examples/gnrc_networking/Makefile`:

diff --git a/examples/gnrc_networking/Makefile b/examples/gnrc_networking/Makefile
index 628b9c9..99ac370 100644
--- a/examples/gnrc_networking/Makefile
+++ b/examples/gnrc_networking/Makefile
@@ -19,7 +19,7 @@ BOARD_INSUFFICIENT_MEMORY := arduino-duemilanove arduino-mega2560 arduino-uno \
 # Include packages that pull up and auto-init the link layer.
 # NOTE: 6LoWPAN will be included if IEEE802.15.4 devices are present
-USEMODULE += gnrc_netdev_default
+USEMODULE += socket_zep
 USEMODULE += auto_init_gnrc_netif
 # Activate ICMPv6 error messages
 USEMODULE += gnrc_icmpv6_error

Compile with ubsan support:

UBSAN_ENABLE=1 UBSAN_MODE=msg_exit make -C examples/gnrc_networking

And start a native instance:

TERMFLAGS="-z [::]:17755,[::1]:17754" make -C examples/gnrc_networking term

Without this PR you will get an error message like this

/home/mlenders/Repositories/RIOT-OS/RIOT/cpu/native/socket_zep/socket_zep.c:52:54: runtime error: signed integer overflow: 332260 * 1000000 cannot be represented in type 'long int'

Details steps to test your contribution:
- which test/example to compile for which board and is there a 'test' command
- how to know that it was not working/available in master
- the expected success test output

### Issues/PRs references
Found with #10782.
Examples: Fixes #1234. See also #5678. Depends on PR #9876.

Please use keywords (e.g., fixes, resolve) with the links to the issues you
resolved, this way they will be automatically closed when your pull request
is merged. See https://help.github.com/articles/closing-issues-using-keywords/.

You can view, comment on, or merge this pull request online at:


-- Commit Summary --

  * socket_zep: fix undefined timestamp conversion behavior

-- File Changes --

    M cpu/native/socket_zep/socket_zep.c (8)

-- Patch Links --


You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.riot-os.org/pipermail/notifications/attachments/20190124/e451b6bc/attachment.html>

More information about the notifications mailing list