aboutsummaryrefslogtreecommitdiffstats
path: root/net/dccp/ccids/ccid3.h
diff options
context:
space:
mode:
authorGerrit Renker <gerrit@erg.abdn.ac.uk>2007-09-26 10:24:28 -0400
committerDavid S. Miller <davem@sunset.davemloft.net>2007-10-10 19:52:41 -0400
commit2e86908f7dfb71b67ca4739d9a6c678b83b01078 (patch)
tree34000d4935057601e86b448698ff5fa55910b852 /net/dccp/ccids/ccid3.h
parent08831700cc65f85a497d6b32b1c83ca84d71de4a (diff)
[CCID3]: Move NULL-protection into function
This moves several instances of testing against NULL into the function which is used to de-reference the CCID-private data. Committer note: Made the BUG_ON depend on having CONFIG_IP_DCCP_CCID3_DEBUG, as it is too much to have this on production code. Also made sure that the macro is used only after checking if sk_state is not LISTEN, to make it equivalent to what we had before. Signed-off-by: Gerrit Renker <gerrit@erg.abdn.ac.uk> Signed-off-by: Ian McDonald <ian.mcdonald@jandi.co.nz> Signed-off-by: Arnaldo Carvalho de Melo <acme@ghostprotocols.net>
Diffstat (limited to 'net/dccp/ccids/ccid3.h')
-rw-r--r--net/dccp/ccids/ccid3.h20
1 files changed, 14 insertions, 6 deletions
diff --git a/net/dccp/ccids/ccid3.h b/net/dccp/ccids/ccid3.h
index 7cbf2b1329d9..ae99ec430371 100644
--- a/net/dccp/ccids/ccid3.h
+++ b/net/dccp/ccids/ccid3.h
@@ -117,6 +117,15 @@ struct ccid3_hc_tx_sock {
117 struct ccid3_options_received ccid3hctx_options_received; 117 struct ccid3_options_received ccid3hctx_options_received;
118}; 118};
119 119
120static inline struct ccid3_hc_tx_sock *ccid3_hc_tx_sk(const struct sock *sk)
121{
122 struct ccid3_hc_tx_sock *hctx = ccid_priv(dccp_sk(sk)->dccps_hc_tx_ccid);
123#ifdef CONFIG_IP_DCCP_CCID3_DEBUG
124 BUG_ON(hctx == NULL);
125#endif
126 return hctx;
127}
128
120/* TFRC receiver states */ 129/* TFRC receiver states */
121enum ccid3_hc_rx_states { 130enum ccid3_hc_rx_states {
122 TFRC_RSTATE_NO_DATA = 1, 131 TFRC_RSTATE_NO_DATA = 1,
@@ -161,14 +170,13 @@ struct ccid3_hc_rx_sock {
161 u32 ccid3hcrx_elapsed_time; 170 u32 ccid3hcrx_elapsed_time;
162}; 171};
163 172
164static inline struct ccid3_hc_tx_sock *ccid3_hc_tx_sk(const struct sock *sk)
165{
166 return ccid_priv(dccp_sk(sk)->dccps_hc_tx_ccid);
167}
168
169static inline struct ccid3_hc_rx_sock *ccid3_hc_rx_sk(const struct sock *sk) 173static inline struct ccid3_hc_rx_sock *ccid3_hc_rx_sk(const struct sock *sk)
170{ 174{
171 return ccid_priv(dccp_sk(sk)->dccps_hc_rx_ccid); 175 struct ccid3_hc_rx_sock *hcrx = ccid_priv(dccp_sk(sk)->dccps_hc_rx_ccid);
176#ifdef CONFIG_IP_DCCP_CCID3_DEBUG
177 BUG_ON(hcrx == NULL);
178#endif
179 return hcrx;
172} 180}
173 181
174#endif /* _DCCP_CCID3_H_ */ 182#endif /* _DCCP_CCID3_H_ */