diff options
Diffstat (limited to 'net/sctp/sm_statetable.c')
-rw-r--r-- | net/sctp/sm_statetable.c | 42 |
1 files changed, 21 insertions, 21 deletions
diff --git a/net/sctp/sm_statetable.c b/net/sctp/sm_statetable.c index 6d9b3aafcc5d..546d4387fb3c 100644 --- a/net/sctp/sm_statetable.c +++ b/net/sctp/sm_statetable.c | |||
@@ -46,6 +46,8 @@ | |||
46 | * be incorporated into the next SCTP release. | 46 | * be incorporated into the next SCTP release. |
47 | */ | 47 | */ |
48 | 48 | ||
49 | #define pr_fmt(fmt) KBUILD_MODNAME ": " fmt | ||
50 | |||
49 | #include <linux/skbuff.h> | 51 | #include <linux/skbuff.h> |
50 | #include <net/sctp/sctp.h> | 52 | #include <net/sctp/sctp.h> |
51 | #include <net/sctp/sm.h> | 53 | #include <net/sctp/sm.h> |
@@ -66,15 +68,19 @@ static const sctp_sm_table_entry_t bug = { | |||
66 | .name = "sctp_sf_bug" | 68 | .name = "sctp_sf_bug" |
67 | }; | 69 | }; |
68 | 70 | ||
69 | #define DO_LOOKUP(_max, _type, _table) \ | 71 | #define DO_LOOKUP(_max, _type, _table) \ |
70 | if ((event_subtype._type > (_max))) { \ | 72 | ({ \ |
71 | printk(KERN_WARNING \ | 73 | const sctp_sm_table_entry_t *rtn; \ |
72 | "sctp table %p possible attack:" \ | 74 | \ |
73 | " event %d exceeds max %d\n", \ | 75 | if ((event_subtype._type > (_max))) { \ |
74 | _table, event_subtype._type, _max); \ | 76 | pr_warn("table %p possible attack: event %d exceeds max %d\n", \ |
75 | return &bug; \ | 77 | _table, event_subtype._type, _max); \ |
76 | } \ | 78 | rtn = &bug; \ |
77 | return &_table[event_subtype._type][(int)state]; | 79 | } else \ |
80 | rtn = &_table[event_subtype._type][(int)state]; \ | ||
81 | \ | ||
82 | rtn; \ | ||
83 | }) | ||
78 | 84 | ||
79 | const sctp_sm_table_entry_t *sctp_sm_lookup_event(sctp_event_t event_type, | 85 | const sctp_sm_table_entry_t *sctp_sm_lookup_event(sctp_event_t event_type, |
80 | sctp_state_t state, | 86 | sctp_state_t state, |
@@ -83,21 +89,15 @@ const sctp_sm_table_entry_t *sctp_sm_lookup_event(sctp_event_t event_type, | |||
83 | switch (event_type) { | 89 | switch (event_type) { |
84 | case SCTP_EVENT_T_CHUNK: | 90 | case SCTP_EVENT_T_CHUNK: |
85 | return sctp_chunk_event_lookup(event_subtype.chunk, state); | 91 | return sctp_chunk_event_lookup(event_subtype.chunk, state); |
86 | break; | ||
87 | case SCTP_EVENT_T_TIMEOUT: | 92 | case SCTP_EVENT_T_TIMEOUT: |
88 | DO_LOOKUP(SCTP_EVENT_TIMEOUT_MAX, timeout, | 93 | return DO_LOOKUP(SCTP_EVENT_TIMEOUT_MAX, timeout, |
89 | timeout_event_table); | 94 | timeout_event_table); |
90 | break; | ||
91 | |||
92 | case SCTP_EVENT_T_OTHER: | 95 | case SCTP_EVENT_T_OTHER: |
93 | DO_LOOKUP(SCTP_EVENT_OTHER_MAX, other, other_event_table); | 96 | return DO_LOOKUP(SCTP_EVENT_OTHER_MAX, other, |
94 | break; | 97 | other_event_table); |
95 | |||
96 | case SCTP_EVENT_T_PRIMITIVE: | 98 | case SCTP_EVENT_T_PRIMITIVE: |
97 | DO_LOOKUP(SCTP_EVENT_PRIMITIVE_MAX, primitive, | 99 | return DO_LOOKUP(SCTP_EVENT_PRIMITIVE_MAX, primitive, |
98 | primitive_event_table); | 100 | primitive_event_table); |
99 | break; | ||
100 | |||
101 | default: | 101 | default: |
102 | /* Yikes! We got an illegal event type. */ | 102 | /* Yikes! We got an illegal event type. */ |
103 | return &bug; | 103 | return &bug; |