net: rxrpc: rxkad: use BUG_ON instead of if condition followed by BUG
Subsystems (3)
PATCH 1/1 net: rxrpc: rxkad: use BUG_ON instead of if condition followed by BUG
Use BUG_ON instead of if condition followed by BUG.
This issue was detected with the help of Coccinelle.
Signed-off-by Gustavo A. R. Silva <[email protected]>
--- net/rxrpc/rxkad.c | 20 ++++++++------------ 1 file changed, 8 insertions(+), 12 deletions(-)
net/rxrpc/rxkad.c +8 -12
@@ -70,9 +70,8 @@ static int rxkad_init_connection_security(struct rxrpc_connection *conn) goto error; } -if (crypto_skcipher_setkey (ci, token->kad->session_key, -sizeof (token->kad->session_key)) <0 ) -BUG (); +BUG_ON (crypto_skcipher_setkey (ci, token->kad->session_key, +sizeof (token->kad->session_key)) <0 );switch (conn->params.security_level) {case RXRPC_SECURITY_PLAIN :
@@ -570,8 +569,7 @@ static void rxkad_locate_data_1(struct rxrpc_call *call, struct sk_buff *skb, {struct rxkad_level1_hdr sechdr; -if (skb_copy_bits (skb, *_offset, &sechdr,sizeof (sechdr)) <0 ) -BUG (); +BUG_ON (skb_copy_bits (skb, *_offset, &sechdr,sizeof (sechdr)) <0 ); *_offset +=sizeof (sechdr); *_len =ntohl (sechdr.data_size) &0xffff ; }
@@ -584,8 +582,7 @@ static void rxkad_locate_data_2(struct rxrpc_call *call, struct sk_buff *skb, {struct rxkad_level2_hdr sechdr; -if (skb_copy_bits (skb, *_offset, &sechdr,sizeof (sechdr)) <0 ) -BUG (); +BUG_ON (skb_copy_bits (skb, *_offset, &sechdr,sizeof (sechdr)) <0 ); *_offset +=sizeof (sechdr); *_len =ntohl (sechdr.data_size) &0xffff ; }
@@ -1022,9 +1019,8 @@ static void rxkad_decrypt_response(struct rxrpc_connection *conn,ASSERT (rxkad_ci !=NULL );mutex_lock (&rxkad_ci_mutex); -if (crypto_skcipher_setkey (rxkad_ci, session_key->x, -sizeof (*session_key)) <0 ) -BUG (); +BUG_ON (crypto_skcipher_setkey (rxkad_ci, session_key->x, +sizeof (*session_key)) <0 );memcpy (&iv, session_key,sizeof (iv));
@@ -1066,8 +1062,8 @@ static int rxkad_verify_response(struct rxrpc_connection *conn,if (skb_copy_bits (skb,sizeof (struct rxrpc_wire_header ), &response,sizeof (response)) <0 ) goto protocol_error; -if (!pskb_pull (skb,sizeof (response))) -BUG (); + +BUG_ON (!pskb_pull (skb,sizeof (response))); version =ntohl (response.version); ticket_len =ntohl (response.ticket_len);
Signature · 1 line
2.7.4