Skip to content

Commit cb3f837

Browse files
wangweidongdavem330
authored andcommitted
sctp: fix checkpatch errors with space required or prohibited
fix checkpatch errors while the space is required or prohibited to the "=,()++..." Acked-by: Neil Horman <nhorman@tuxdriver.com> Signed-off-by: Wang Weidong <wangweidong1@huawei.com> Signed-off-by: David S. Miller <davem@davemloft.net>
1 parent 4c99aa4 commit cb3f837

10 files changed

Lines changed: 43 additions & 43 deletions

File tree

‎net/sctp/auth.c‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ static struct sctp_hmac sctp_hmac_list[SCTP_AUTH_NUM_HMACS] = {
4141
},
4242
{
4343
.hmac_id = SCTP_AUTH_HMAC_ID_SHA1,
44-
.hmac_name="hmac(sha1)",
44+
.hmac_name = "hmac(sha1)",
4545
.hmac_len = SCTP_SHA1_SIG_SIZE,
4646
},
4747
{
@@ -51,7 +51,7 @@ static struct sctp_hmac sctp_hmac_list[SCTP_AUTH_NUM_HMACS] = {
5151
#if defined (CONFIG_CRYPTO_SHA256) || defined (CONFIG_CRYPTO_SHA256_MODULE)
5252
{
5353
.hmac_id = SCTP_AUTH_HMAC_ID_SHA256,
54-
.hmac_name="hmac(sha256)",
54+
.hmac_name = "hmac(sha256)",
5555
.hmac_len = SCTP_SHA256_SIG_SIZE,
5656
}
5757
#endif
@@ -163,7 +163,7 @@ static int sctp_auth_compare_vectors(struct sctp_auth_bytes *vector1,
163163
* lead-zero padded. If it is not, it
164164
* is automatically larger numerically.
165165
*/
166-
for (i = 0; i < abs(diff); i++ ) {
166+
for (i = 0; i < abs(diff); i++) {
167167
if (longer[i] != 0)
168168
return diff;
169169
}

‎net/sctp/chunk.c‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -254,7 +254,7 @@ struct sctp_datamsg *sctp_datamsg_from_user(struct sctp_association *asoc,
254254
SCTP_INC_STATS_USER(sock_net(asoc->base.sk), SCTP_MIB_FRAGUSRMSGS);
255255

256256
/* Create chunks for all the full sized DATA chunks. */
257-
for (i=0, len=first_len; i < whole; i++) {
257+
for (i = 0, len = first_len; i < whole; i++) {
258258
frag = SCTP_DATA_MIDDLE_FRAG;
259259

260260
if (0 == i)
@@ -317,7 +317,7 @@ struct sctp_datamsg *sctp_datamsg_from_user(struct sctp_association *asoc,
317317
goto errout;
318318
}
319319

320-
err = sctp_user_addto_chunk(chunk, offset, over,msgh->msg_iov);
320+
err = sctp_user_addto_chunk(chunk, offset, over, msgh->msg_iov);
321321

322322
/* Put the chunk->skb back into the form expected by send. */
323323
__skb_pull(chunk->skb, (__u8 *)chunk->chunk_hdr

‎net/sctp/input.c‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -119,7 +119,7 @@ int sctp_rcv(struct sk_buff *skb)
119119
struct sctp_af *af;
120120
struct net *net = dev_net(skb->dev);
121121

122-
if (skb->pkt_type!=PACKET_HOST)
122+
if (skb->pkt_type != PACKET_HOST)
123123
goto discard_it;
124124

125125
SCTP_INC_STATS_BH(net, SCTP_MIB_INSCTPPACKS);
@@ -1055,7 +1055,7 @@ static struct sctp_association *__sctp_rcv_walk_lookup(struct net *net,
10551055
if (ch_end > skb_tail_pointer(skb))
10561056
break;
10571057

1058-
switch(ch->type) {
1058+
switch (ch->type) {
10591059
case SCTP_CID_AUTH:
10601060
have_auth = chunk_num;
10611061
break;

‎net/sctp/ipv6.c‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -402,7 +402,7 @@ static void sctp_v6_copy_addrlist(struct list_head *addrlist,
402402
}
403403

404404
/* Initialize a sockaddr_storage from in incoming skb. */
405-
static void sctp_v6_from_skb(union sctp_addr *addr,struct sk_buff *skb,
405+
static void sctp_v6_from_skb(union sctp_addr *addr, struct sk_buff *skb,
406406
int is_saddr)
407407
{
408408
__be16 *port;

‎net/sctp/outqueue.c‎

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -110,7 +110,7 @@ static inline int sctp_cacc_skip_3_1_d(struct sctp_transport *primary,
110110
struct sctp_transport *transport,
111111
int count_of_newacks)
112112
{
113-
if (count_of_newacks >=2 && transport != primary)
113+
if (count_of_newacks >= 2 && transport != primary)
114114
return 1;
115115
return 0;
116116
}
@@ -470,7 +470,7 @@ void sctp_retransmit(struct sctp_outq *q, struct sctp_transport *transport,
470470
struct net *net = sock_net(q->asoc->base.sk);
471471
int error = 0;
472472

473-
switch(reason) {
473+
switch (reason) {
474474
case SCTP_RTXR_T3_RTX:
475475
SCTP_INC_STATS(net, SCTP_MIB_T3_RETRANSMITS);
476476
sctp_transport_lower_cwnd(transport, SCTP_LOWER_CWND_T3_RTX);
@@ -1088,7 +1088,7 @@ static int sctp_outq_flush(struct sctp_outq *q, int rtx_timeout)
10881088
*
10891089
* --xguo
10901090
*/
1091-
while ((ltransport = sctp_list_dequeue(&transport_list)) != NULL ) {
1091+
while ((ltransport = sctp_list_dequeue(&transport_list)) != NULL) {
10921092
struct sctp_transport *t = list_entry(ltransport,
10931093
struct sctp_transport,
10941094
send_ready);
@@ -1217,7 +1217,7 @@ int sctp_outq_sack(struct sctp_outq *q, struct sctp_chunk *chunk)
12171217
* destinations for which cacc_saw_newack is set.
12181218
*/
12191219
if (transport->cacc.cacc_saw_newack)
1220-
count_of_newacks ++;
1220+
count_of_newacks++;
12211221
}
12221222

12231223
/* Move the Cumulative TSN Ack Point if appropriate. */

‎net/sctp/sm_make_chunk.c‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2308,7 +2308,7 @@ int sctp_process_init(struct sctp_association *asoc, struct sctp_chunk *chunk,
23082308
* added as the primary transport. The source address seems to
23092309
* be a a better choice than any of the embedded addresses.
23102310
*/
2311-
if(!sctp_assoc_add_peer(asoc, peer_addr, gfp, SCTP_ACTIVE))
2311+
if (!sctp_assoc_add_peer(asoc, peer_addr, gfp, SCTP_ACTIVE))
23122312
goto nomem;
23132313

23142314
if (sctp_cmp_addr_exact(sctp_source(chunk), peer_addr))
@@ -3334,7 +3334,7 @@ static __be16 sctp_get_asconf_response(struct sctp_chunk *asconf_ack,
33343334

33353335
while (asconf_ack_len > 0) {
33363336
if (asconf_ack_param->crr_id == asconf_param->crr_id) {
3337-
switch(asconf_ack_param->param_hdr.type) {
3337+
switch (asconf_ack_param->param_hdr.type) {
33383338
case SCTP_PARAM_SUCCESS_REPORT:
33393339
return SCTP_ERROR_NO_ERROR;
33403340
case SCTP_PARAM_ERR_CAUSE:

‎net/sctp/sm_sideeffect.c‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -404,7 +404,7 @@ void sctp_generate_proto_unreach_event(unsigned long data)
404404
struct sctp_transport *transport = (struct sctp_transport *) data;
405405
struct sctp_association *asoc = transport->asoc;
406406
struct net *net = sock_net(asoc->base.sk);
407-
407+
408408
sctp_bh_lock_sock(asoc->base.sk);
409409
if (sock_owned_by_user(asoc->base.sk)) {
410410
pr_debug("%s: sock is busy\n", __func__);
@@ -543,7 +543,7 @@ static void sctp_cmd_init_failed(sctp_cmd_seq_t *commands,
543543
{
544544
struct sctp_ulpevent *event;
545545

546-
event = sctp_ulpevent_make_assoc_change(asoc,0, SCTP_CANT_STR_ASSOC,
546+
event = sctp_ulpevent_make_assoc_change(asoc, 0, SCTP_CANT_STR_ASSOC,
547547
(__u16)error, 0, 0, NULL,
548548
GFP_ATOMIC);
549549

‎net/sctp/sm_statefuns.c‎

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -2945,7 +2945,7 @@ sctp_disposition_t sctp_sf_eat_data_6_2(struct net *net,
29452945
return sctp_sf_violation_chunklen(net, ep, asoc, type, arg,
29462946
commands);
29472947

2948-
error = sctp_eat_data(asoc, chunk, commands );
2948+
error = sctp_eat_data(asoc, chunk, commands);
29492949
switch (error) {
29502950
case SCTP_IERROR_NO_ERROR:
29512951
break;
@@ -3066,7 +3066,7 @@ sctp_disposition_t sctp_sf_eat_data_fast_4_4(struct net *net,
30663066
return sctp_sf_violation_chunklen(net, ep, asoc, type, arg,
30673067
commands);
30683068

3069-
error = sctp_eat_data(asoc, chunk, commands );
3069+
error = sctp_eat_data(asoc, chunk, commands);
30703070
switch (error) {
30713071
case SCTP_IERROR_NO_ERROR:
30723072
case SCTP_IERROR_HIGH_TSN:
@@ -3765,7 +3765,7 @@ sctp_disposition_t sctp_sf_do_asconf_ack(struct net *net,
37653765
*/
37663766
sctp_add_cmd_sf(commands, SCTP_CMD_TIMER_STOP,
37673767
SCTP_TO(SCTP_EVENT_TIMEOUT_T4_RTO));
3768-
sctp_add_cmd_sf(commands, SCTP_CMD_DISCARD_PACKET,SCTP_NULL());
3768+
sctp_add_cmd_sf(commands, SCTP_CMD_DISCARD_PACKET, SCTP_NULL());
37693769
sctp_add_cmd_sf(commands, SCTP_CMD_SET_SK_ERR,
37703770
SCTP_ERROR(ECONNABORTED));
37713771
sctp_add_cmd_sf(commands, SCTP_CMD_ASSOC_FAILED,
@@ -3799,7 +3799,7 @@ sctp_disposition_t sctp_sf_do_asconf_ack(struct net *net,
37993799
/* We are going to ABORT, so we might as well stop
38003800
* processing the rest of the chunks in the packet.
38013801
*/
3802-
sctp_add_cmd_sf(commands, SCTP_CMD_DISCARD_PACKET,SCTP_NULL());
3802+
sctp_add_cmd_sf(commands, SCTP_CMD_DISCARD_PACKET, SCTP_NULL());
38033803
sctp_add_cmd_sf(commands, SCTP_CMD_SET_SK_ERR,
38043804
SCTP_ERROR(ECONNABORTED));
38053805
sctp_add_cmd_sf(commands, SCTP_CMD_ASSOC_FAILED,
@@ -4451,7 +4451,7 @@ static sctp_disposition_t sctp_sf_violation_chunklen(
44514451
void *arg,
44524452
sctp_cmd_seq_t *commands)
44534453
{
4454-
static const char err_str[]="The following chunk had invalid length:";
4454+
static const char err_str[] = "The following chunk had invalid length:";
44554455

44564456
return sctp_sf_abort_violation(net, ep, asoc, arg, commands, err_str,
44574457
sizeof(err_str));
@@ -4514,7 +4514,7 @@ static sctp_disposition_t sctp_sf_violation_ctsn(
45144514
void *arg,
45154515
sctp_cmd_seq_t *commands)
45164516
{
4517-
static const char err_str[]="The cumulative tsn ack beyond the max tsn currently sent:";
4517+
static const char err_str[] = "The cumulative tsn ack beyond the max tsn currently sent:";
45184518

45194519
return sctp_sf_abort_violation(net, ep, asoc, arg, commands, err_str,
45204520
sizeof(err_str));
@@ -4534,7 +4534,7 @@ static sctp_disposition_t sctp_sf_violation_chunk(
45344534
void *arg,
45354535
sctp_cmd_seq_t *commands)
45364536
{
4537-
static const char err_str[]="The following chunk violates protocol:";
4537+
static const char err_str[] = "The following chunk violates protocol:";
45384538

45394539
if (!asoc)
45404540
return sctp_sf_violation(net, ep, asoc, type, arg, commands);
@@ -6000,7 +6000,7 @@ static struct sctp_packet *sctp_ootb_pkt_new(struct net *net,
60006000
/* Special case the INIT-ACK as there is no peer's vtag
60016001
* yet.
60026002
*/
6003-
switch(chunk->chunk_hdr->type) {
6003+
switch (chunk->chunk_hdr->type) {
60046004
case SCTP_CID_INIT_ACK:
60056005
{
60066006
sctp_initack_chunk_t *initack;
@@ -6017,7 +6017,7 @@ static struct sctp_packet *sctp_ootb_pkt_new(struct net *net,
60176017
/* Special case the INIT and stale COOKIE_ECHO as there is no
60186018
* vtag yet.
60196019
*/
6020-
switch(chunk->chunk_hdr->type) {
6020+
switch (chunk->chunk_hdr->type) {
60216021
case SCTP_CID_INIT:
60226022
{
60236023
sctp_init_chunk_t *init;
@@ -6231,7 +6231,7 @@ static int sctp_eat_data(const struct sctp_association *asoc,
62316231
/* We are going to ABORT, so we might as well stop
62326232
* processing the rest of the chunks in the packet.
62336233
*/
6234-
sctp_add_cmd_sf(commands, SCTP_CMD_DISCARD_PACKET,SCTP_NULL());
6234+
sctp_add_cmd_sf(commands, SCTP_CMD_DISCARD_PACKET, SCTP_NULL());
62356235
sctp_add_cmd_sf(commands, SCTP_CMD_SET_SK_ERR,
62366236
SCTP_ERROR(ECONNABORTED));
62376237
sctp_add_cmd_sf(commands, SCTP_CMD_ASSOC_FAILED,

‎net/sctp/socket.c‎

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1568,7 +1568,7 @@ static int sctp_sendmsg(struct kiocb *iocb, struct sock *sk,
15681568
struct net *net = sock_net(sk);
15691569
struct sctp_sock *sp;
15701570
struct sctp_endpoint *ep;
1571-
struct sctp_association *new_asoc=NULL, *asoc=NULL;
1571+
struct sctp_association *new_asoc = NULL, *asoc = NULL;
15721572
struct sctp_transport *transport, *chunk_tp;
15731573
struct sctp_chunk *chunk;
15741574
union sctp_addr to;
@@ -2462,7 +2462,7 @@ static int sctp_setsockopt_peer_addr_params(struct sock *sk,
24622462
int hb_change, pmtud_change, sackdelay_change;
24632463

24642464
if (optlen != sizeof(struct sctp_paddrparams))
2465-
return - EINVAL;
2465+
return -EINVAL;
24662466

24672467
if (copy_from_user(&params, optval, optlen))
24682468
return -EFAULT;
@@ -2483,7 +2483,7 @@ static int sctp_setsockopt_peer_addr_params(struct sock *sk,
24832483
/* If an address other than INADDR_ANY is specified, and
24842484
* no transport is found, then the request is invalid.
24852485
*/
2486-
if (!sctp_is_any(sk, ( union sctp_addr *)&params.spp_address)) {
2486+
if (!sctp_is_any(sk, (union sctp_addr *)&params.spp_address)) {
24872487
trans = sctp_addr_id2transport(sk, &params.spp_address,
24882488
params.spp_assoc_id);
24892489
if (!trans)
@@ -2588,7 +2588,7 @@ static int sctp_setsockopt_delayed_ack(struct sock *sk,
25882588
else
25892589
params.sack_freq = 0;
25902590
} else
2591-
return - EINVAL;
2591+
return -EINVAL;
25922592

25932593
/* Validate value parameter. */
25942594
if (params.sack_delay > 500)
@@ -3332,7 +3332,7 @@ static int sctp_setsockopt_hmac_ident(struct sock *sk,
33323332
if (optlen < sizeof(struct sctp_hmacalgo))
33333333
return -EINVAL;
33343334

3335-
hmacs= memdup_user(optval, optlen);
3335+
hmacs = memdup_user(optval, optlen);
33363336
if (IS_ERR(hmacs))
33373337
return PTR_ERR(hmacs);
33383338

@@ -3370,7 +3370,7 @@ static int sctp_setsockopt_auth_key(struct sock *sk,
33703370
if (optlen <= sizeof(struct sctp_authkey))
33713371
return -EINVAL;
33723372

3373-
authkey= memdup_user(optval, optlen);
3373+
authkey = memdup_user(optval, optlen);
33743374
if (IS_ERR(authkey))
33753375
return PTR_ERR(authkey);
33763376

@@ -4467,7 +4467,7 @@ static int sctp_getsockopt_peer_addr_params(struct sock *sk, int len,
44674467
/* If an address other than INADDR_ANY is specified, and
44684468
* no transport is found, then the request is invalid.
44694469
*/
4470-
if (!sctp_is_any(sk, ( union sctp_addr *)&params.spp_address)) {
4470+
if (!sctp_is_any(sk, (union sctp_addr *)&params.spp_address)) {
44714471
trans = sctp_addr_id2transport(sk, &params.spp_address,
44724472
params.spp_assoc_id);
44734473
if (!trans) {
@@ -4578,7 +4578,7 @@ static int sctp_getsockopt_delayed_ack(struct sock *sk, int len,
45784578
if (copy_from_user(&params, optval, len))
45794579
return -EFAULT;
45804580
} else
4581-
return - EINVAL;
4581+
return -EINVAL;
45824582

45834583
/* Get association, if sack_assoc_id != 0 and the socket is a one
45844584
* to many style socket, and an association was not found, then
@@ -4668,8 +4668,8 @@ static int sctp_getsockopt_peer_addrs(struct sock *sk, int len,
46684668
if (!asoc)
46694669
return -EINVAL;
46704670

4671-
to = optval + offsetof(struct sctp_getaddrs,addrs);
4672-
space_left = len - offsetof(struct sctp_getaddrs,addrs);
4671+
to = optval + offsetof(struct sctp_getaddrs, addrs);
4672+
space_left = len - offsetof(struct sctp_getaddrs, addrs);
46734673

46744674
list_for_each_entry(from, &asoc->peer.transport_addr_list,
46754675
transports) {
@@ -4729,7 +4729,7 @@ static int sctp_copy_laddrs(struct sock *sk, __u16 port, void *to,
47294729
memcpy(to, &temp, addrlen);
47304730

47314731
to += addrlen;
4732-
cnt ++;
4732+
cnt++;
47334733
space_left -= addrlen;
47344734
*bytes_copied += addrlen;
47354735
}
@@ -4778,8 +4778,8 @@ static int sctp_getsockopt_local_addrs(struct sock *sk, int len,
47784778
bp = &asoc->base.bind_addr;
47794779
}
47804780

4781-
to = optval + offsetof(struct sctp_getaddrs,addrs);
4782-
space_left = len - offsetof(struct sctp_getaddrs,addrs);
4781+
to = optval + offsetof(struct sctp_getaddrs, addrs);
4782+
space_left = len - offsetof(struct sctp_getaddrs, addrs);
47834783

47844784
addrs = kmalloc(space_left, GFP_KERNEL);
47854785
if (!addrs)
@@ -4818,7 +4818,7 @@ static int sctp_getsockopt_local_addrs(struct sock *sk, int len,
48184818
memcpy(buf, &temp, addrlen);
48194819
buf += addrlen;
48204820
bytes_copied += addrlen;
4821-
cnt ++;
4821+
cnt++;
48224822
space_left -= addrlen;
48234823
}
48244824

@@ -5090,7 +5090,7 @@ static int sctp_getsockopt_associnfo(struct sock *sk, int len,
50905090
assocparams.sasoc_cookie_life = ktime_to_ms(asoc->cookie_life);
50915091

50925092
list_for_each(pos, &asoc->peer.transport_addr_list) {
5093-
cnt ++;
5093+
cnt++;
50945094
}
50955095

50965096
assocparams.sasoc_number_peer_destinations = cnt;

‎net/sctp/ulpqueue.c‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -107,7 +107,7 @@ int sctp_ulpq_tail_data(struct sctp_ulpq *ulpq, struct sctp_chunk *chunk,
107107
event = sctp_ulpq_reasm(ulpq, event);
108108

109109
/* Do ordering if needed. */
110-
if ((event) && (event->msg_flags & MSG_EOR)){
110+
if ((event) && (event->msg_flags & MSG_EOR)) {
111111
/* Create a temporary list to collect chunks on. */
112112
skb_queue_head_init(&temp);
113113
__skb_queue_tail(&temp, sctp_event2skb(event));
@@ -726,7 +726,7 @@ static void sctp_ulpq_reasm_drain(struct sctp_ulpq *ulpq)
726726

727727
while ((event = sctp_ulpq_retrieve_reassembled(ulpq)) != NULL) {
728728
/* Do ordering if needed. */
729-
if ((event) && (event->msg_flags & MSG_EOR)){
729+
if ((event) && (event->msg_flags & MSG_EOR)) {
730730
skb_queue_head_init(&temp);
731731
__skb_queue_tail(&temp, sctp_event2skb(event));
732732

0 commit comments

Comments
 (0)