Skip to main content
Andrei Chichak
Lead
June 6, 2018
Question

Case statement fall through maintenance bug in usbd_cdc.c

  • June 6, 2018
  • 1 reply
  • 439 views
Posted on June 06, 2018 at 20:38

cppcheck pointed out that usbd_cdc.c has a missing break statement around line 652.

The next case is a default:/break;, but if another case is inserted between the offender and the default, a fall through would happen.

Andrei

    This topic has been closed for replies.

    1 reply

    Pavel A.
    Super User
    June 7, 2018
    Posted on June 08, 2018 at 01:14

    A good catch.  By the way, ability to do

    https://github.com/pavel-a/stm32f4_libs/blob/c4560650ddaea6ee33de171027d801a31109565a/STM32Cube_FW_F4/Middlewares/ST/STM32_USB_Device_Library/Class/CDC/Src/usbd_cdc.c#L650

    is one of reasons to put the STM32 libraries on GitHub. The recent news of Microsoft acquisition may scare some people away from GitHub... but there still are other git hosters  - Bitbucket, for one.