[riot-notifications] [RIOT-OS/RIOT] tree-wide: avoid netdev dereference (#16577)

José Alamos notifications at github.com
Tue Jun 22 11:41:18 CEST 2021

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
This PR removes all netdev<->driver dereferences and replace them with `container_of`.
This step is important to prevent wrong dereferences when migrating the IEEE 802.15.4 path to the Radio HAL/SubMAC.
Since I already touched several files, I decided to do it tree-wide since this also adds a layer of security.
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
This should be tested carefully, although I think a compile test should suffice. Wrong conversions will be pointed out by the compiler.
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
Related to #13943 
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 --

  * at86rf2xx: avoid netdev dereference
  * mrf24j40: avoid netdev dereference
  * kw2xrf: avoid netdev dereference
  * kw41zrf: avoid netdev dereference
  * cc2538_rf: avoid netdev dereference
  * nrf802154: avoid netdev dereference
  * at86rf215: avoid netdev dereference
  * cc2420: avoid netdev dereference
  * socket_zep: avoid netdev dereference
  * esp-eth: avoid netdev dereference
  * esp-now: avoid netdev dereference
  * esp-wifi: avoid netdev dereference
  * netdev_tap: avoid netdev dereference
  * stm32/eth: avoid netdev dereference
  * netdev_ieee802154_submac: avoid netdev dereference
  * nrf24l01p_ng: avoid netdev dereference
  * rn2xx3: avoid netdev dereference
  * sx126x: avoid netdev dereference
  * sx127x: avoid netdev dereference
  * examples/lorawan: avoid netdev dereference
  * lwip: avoid netdev dereference
  * openthread: avoid netdev dereference
  * openwsn: avoid netdev dereference
  * auto_init/loramac: avoid netdev dereference
  * link_layer/gomach: avoid netdev dereference
  * link_layer/lwmac: avoid netdev dereference
  * gnrc_netif_ieee802154: avoid netdev dereference
  * netdev_test: avoid netdev dereference
  * tests/gnrc_netif: avoid netdev dereference
  * tests/ieee802154_submac: avoid netdev dereference
  * semtech-loramac: avoid netdev dereference

-- File Changes --

    M cpu/cc2538/radio/cc2538_rf.c (4)
    M cpu/cc2538/radio/cc2538_rf_netdev.c (6)
    M cpu/esp32/esp-eth/esp_eth_netdev.c (10)
    M cpu/esp_common/esp-now/esp_now_gnrc.c (2)
    M cpu/esp_common/esp-now/esp_now_netdev.c (12)
    M cpu/esp_common/esp-wifi/esp_wifi_netdev.c (8)
    M cpu/native/netdev_tap/netdev_tap.c (16)
    M cpu/native/socket_zep/socket_zep.c (12)
    M cpu/nrf52/radio/nrf802154/nrf802154.c (4)
    M cpu/nrf52/radio/nrf802154/nrf802154_radio.c (4)
    M cpu/stm32/periph/eth.c (2)
    M drivers/at86rf215/at86rf215.c (2)
    M drivers/at86rf215/at86rf215_netdev.c (18)
    M drivers/at86rf2xx/at86rf2xx.c (2)
    M drivers/at86rf2xx/at86rf2xx_netdev.c (32)
    M drivers/cc2420/cc2420_netdev.c (14)
    M drivers/kw2xrf/kw2xrf.c (2)
    M drivers/kw2xrf/kw2xrf_netdev.c (26)
    M drivers/kw41zrf/kw41zrf.c (2)
    M drivers/kw41zrf/kw41zrf_netdev.c (14)
    M drivers/mrf24j40/mrf24j40.c (5)
    M drivers/mrf24j40/mrf24j40_netdev.c (16)
    M drivers/netdev_ieee802154_submac/netdev_ieee802154_submac.c (20)
    M drivers/nrf24l01p_ng/gnrc_netif_nrf24l01p_ng.c (4)
    M drivers/nrf24l01p_ng/nrf24l01p_ng_netdev.c (14)
    M drivers/rn2xx3/rn2xx3.c (6)
    M drivers/sx126x/sx126x.c (2)
    M drivers/sx126x/sx126x_netdev.c (14)
    M drivers/sx127x/sx127x.c (14)
    M drivers/sx127x/sx127x_netdev.c (28)
    M examples/lorawan/main.c (4)
    M pkg/lwip/contrib/netdev/lwip_netdev.c (6)
    M pkg/openthread/contrib/openthread.c (8)
    M pkg/openwsn/contrib/radio_netdev.c (2)
    M pkg/semtech-loramac/contrib/semtech_loramac.c (10)
    M sys/auto_init/loramac/auto_init_loramac.c (4)
    M sys/net/gnrc/link_layer/gomach/gomach.c (35)
    M sys/net/gnrc/link_layer/gomach/gomach_internal.c (5)
    M sys/net/gnrc/link_layer/lwmac/lwmac.c (2)
    M sys/net/gnrc/link_layer/lwmac/lwmac_internal.c (2)
    M sys/net/gnrc/netif/ieee802154/gnrc_netif_ieee802154.c (2)
    M sys/net/netdev_test/netdev_test.c (14)
    M tests/driver_at86rf215/main.c (6)
    M tests/driver_at86rf2xx/cmd.c (4)
    M tests/driver_at86rf2xx/main.c (2)
    M tests/driver_sx126x/main.c (6)
    M tests/driver_sx127x/main.c (26)
    M tests/gnrc_netif/common.c (10)
    M tests/ieee802154_submac/main.c (6)
    M tests/socket_zep/main.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/20210622/31a442d6/attachment.htm>

More information about the notifications mailing list