Commit 79133506 authored by Gerrit Renker's avatar Gerrit Renker Committed by David S. Miller

[DCCP]: Collapse repeated `len' statements into one

This replaces 4 individual assignments for `len' with a single
one, placed where the control flow of those 4 leads to.
Signed-off-by: default avatarGerrit Renker <gerrit@erg.abdn.ac.uk>
Signed-off-by: default avatarIan McDonald <ian.mcdonald@jandi.co.nz>
Signed-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent b8599d20
...@@ -657,19 +657,15 @@ static int do_dccp_getsockopt(struct sock *sk, int level, int optname, ...@@ -657,19 +657,15 @@ static int do_dccp_getsockopt(struct sock *sk, int level, int optname,
(__be32 __user *)optval, optlen); (__be32 __user *)optval, optlen);
case DCCP_SOCKOPT_GET_CUR_MPS: case DCCP_SOCKOPT_GET_CUR_MPS:
val = dp->dccps_mss_cache; val = dp->dccps_mss_cache;
len = sizeof(val);
break; break;
case DCCP_SOCKOPT_SERVER_TIMEWAIT: case DCCP_SOCKOPT_SERVER_TIMEWAIT:
val = dp->dccps_server_timewait; val = dp->dccps_server_timewait;
len = sizeof(val);
break; break;
case DCCP_SOCKOPT_SEND_CSCOV: case DCCP_SOCKOPT_SEND_CSCOV:
val = dp->dccps_pcslen; val = dp->dccps_pcslen;
len = sizeof(val);
break; break;
case DCCP_SOCKOPT_RECV_CSCOV: case DCCP_SOCKOPT_RECV_CSCOV:
val = dp->dccps_pcrlen; val = dp->dccps_pcrlen;
len = sizeof(val);
break; break;
case 128 ... 191: case 128 ... 191:
return ccid_hc_rx_getsockopt(dp->dccps_hc_rx_ccid, sk, optname, return ccid_hc_rx_getsockopt(dp->dccps_hc_rx_ccid, sk, optname,
...@@ -681,6 +677,7 @@ static int do_dccp_getsockopt(struct sock *sk, int level, int optname, ...@@ -681,6 +677,7 @@ static int do_dccp_getsockopt(struct sock *sk, int level, int optname,
return -ENOPROTOOPT; return -ENOPROTOOPT;
} }
len = sizeof(val);
if (put_user(len, optlen) || copy_to_user(optval, &val, len)) if (put_user(len, optlen) || copy_to_user(optval, &val, len))
return -EFAULT; return -EFAULT;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment