Skip to content

Commit

Permalink
static-analysis: make BUG an infinite-loop
Browse files Browse the repository at this point in the history
Static code analysis tools likely do not understand that the ud2 inline
assembly instruction means that the control flow is terminated.
Consequently, we need to add an artificial infinite loop to make sure we
cannot continue when hitting a bug.

Signed-off-by: Norbert Manthey <[email protected]>
  • Loading branch information
nmanthey authored and wipawel committed Oct 22, 2020
1 parent 0509429 commit aff3c68
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion include/lib.h
Original file line number Diff line number Diff line change
Expand Up @@ -303,7 +303,7 @@ static inline void ud2(void) { asm volatile("ud2"); }
#define BUG() \
do { \
ud2(); \
} while (0)
} while (true)
#define BUG_ON(cond) \
do { \
if ((cond)) \
Expand Down

0 comments on commit aff3c68

Please sign in to comment.