KVM
Macros | Functions
list_debug.c File Reference
#include <linux/list.h>
#include <linux/bug.h>
Include dependency graph for list_debug.c:

Go to the source code of this file.

Macros

#define NVHE_CHECK_DATA_CORRUPTION(condition)
 

Functions

static __must_check bool nvhe_check_data_corruption (bool v)
 
__list_valid_slowpath bool __list_add_valid_or_report (struct list_head *new, struct list_head *prev, struct list_head *next)
 
__list_valid_slowpath bool __list_del_entry_valid_or_report (struct list_head *entry)
 

Macro Definition Documentation

◆ NVHE_CHECK_DATA_CORRUPTION

#define NVHE_CHECK_DATA_CORRUPTION (   condition)
Value:
bool corruption = unlikely(condition); \
if (corruption) { \
if (IS_ENABLED(CONFIG_BUG_ON_DATA_CORRUPTION)) { \
BUG_ON(1); \
} else \
WARN_ON(1); \
} \
corruption; \
}))
static __must_check bool nvhe_check_data_corruption(bool v)
Definition: list_debug.c:10

Definition at line 15 of file list_debug.c.

Function Documentation

◆ __list_add_valid_or_report()

__list_valid_slowpath bool __list_add_valid_or_report ( struct list_head *  new,
struct list_head *  prev,
struct list_head *  next 
)

Definition at line 30 of file list_debug.c.

32 {
33  if (NVHE_CHECK_DATA_CORRUPTION(next->prev != prev) ||
34  NVHE_CHECK_DATA_CORRUPTION(prev->next != next) ||
35  NVHE_CHECK_DATA_CORRUPTION(new == prev || new == next))
36  return false;
37 
38  return true;
39 }
#define NVHE_CHECK_DATA_CORRUPTION(condition)
Definition: list_debug.c:15

◆ __list_del_entry_valid_or_report()

__list_valid_slowpath bool __list_del_entry_valid_or_report ( struct list_head *  entry)

Definition at line 42 of file list_debug.c.

43 {
44  struct list_head *prev, *next;
45 
46  prev = entry->prev;
47  next = entry->next;
48 
49  if (NVHE_CHECK_DATA_CORRUPTION(next == LIST_POISON1) ||
50  NVHE_CHECK_DATA_CORRUPTION(prev == LIST_POISON2) ||
51  NVHE_CHECK_DATA_CORRUPTION(prev->next != entry) ||
52  NVHE_CHECK_DATA_CORRUPTION(next->prev != entry))
53  return false;
54 
55  return true;
56 }

◆ nvhe_check_data_corruption()

static __must_check bool nvhe_check_data_corruption ( bool  v)
inlinestatic

Definition at line 10 of file list_debug.c.

11 {
12  return v;
13 }