From mboxrd@z Thu Jan 1 00:00:00 1970 From: Ursula Braun Subject: [PATCH net-next 1/1] net/smc: remove duplicate check in smc_setsockopt Date: Fri, 1 Jun 2018 16:58:39 +0200 Message-ID: <20180601145839.22566-1-ubraun@linux.ibm.com> Cc: netdev@vger.kernel.org, linux-s390@vger.kernel.org, schwidefsky@de.ibm.com, heiko.carstens@de.ibm.com, raspl@linux.ibm.com, ubraun@linux.ibm.com To: davem@davemloft.net Return-path: Received: from mx0a-001b2d01.pphosted.com ([148.163.156.1]:57162 "EHLO mx0a-001b2d01.pphosted.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751512AbeFAO6u (ORCPT ); Fri, 1 Jun 2018 10:58:50 -0400 Received: from pps.filterd (m0098409.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.16.0.22/8.16.0.22) with SMTP id w51EwhmV095053 for ; Fri, 1 Jun 2018 10:58:50 -0400 Received: from e06smtp01.uk.ibm.com (e06smtp01.uk.ibm.com [195.75.94.97]) by mx0a-001b2d01.pphosted.com with ESMTP id 2jb7gejmmb-1 (version=TLSv1.2 cipher=AES256-GCM-SHA384 bits=256 verify=NOT) for ; Fri, 01 Jun 2018 10:58:49 -0400 Received: from localhost by e06smtp01.uk.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Fri, 1 Jun 2018 15:58:47 +0100 Sender: netdev-owner@vger.kernel.org List-ID: From: Ursula Braun smc_setsockopt contains a check for the length specified on the setsockopt socket call. If checked, it is supposed to return with EINVAL. But the equivalent check is already contained in the preceding setsockopt call on the internal TCP socket. That means, the extra check can be removed. Signed-off-by: Ursula Braun Fixes: 01d2f7e2cdd3 ("net/smc: sockopts TCP_NODELAY and TCP_CORK") Reported-by: Wei Yongjun --- net/smc/af_smc.c | 2 -- 1 file changed, 2 deletions(-) diff --git a/net/smc/af_smc.c b/net/smc/af_smc.c index 2c369d4bb1c1..dec3f09f6327 100644 --- a/net/smc/af_smc.c +++ b/net/smc/af_smc.c @@ -1419,8 +1419,6 @@ static int smc_setsockopt(struct socket *sock, int level, int optname, if (rc) return rc; - if (optlen < sizeof(int)) - return rc; get_user(val, (int __user *)optval); lock_sock(sk); -- 2.16.3