From owner-svn-src-head@freebsd.org Thu Sep 22 12:41:55 2016 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 0EE16BE559D; Thu, 22 Sep 2016 12:41:55 +0000 (UTC) (envelope-from br@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id D60648E8; Thu, 22 Sep 2016 12:41:54 +0000 (UTC) (envelope-from br@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u8MCfse9097500; Thu, 22 Sep 2016 12:41:54 GMT (envelope-from br@FreeBSD.org) Received: (from br@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u8MCfsvv097499; Thu, 22 Sep 2016 12:41:54 GMT (envelope-from br@FreeBSD.org) Message-Id: <201609221241.u8MCfsvv097499@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: br set sender to br@FreeBSD.org using -f From: Ruslan Bukin Date: Thu, 22 Sep 2016 12:41:54 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r306186 - head/sys/kern X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 22 Sep 2016 12:41:55 -0000 Author: br Date: Thu Sep 22 12:41:53 2016 New Revision: 306186 URL: https://svnweb.freebsd.org/changeset/base/306186 Log: Adjust the sopt_val pointer on bigendian systems (e.g. MIPS64EB). sooptcopyin() checks if size of data provided by user is <= than we can accept, else it strips down the size. On bigendian platforms we have to move pointer as well so we copy the actual data. Reviewed by: gnn Sponsored by: DARPA, AFRL Sponsored by: HEIF5 Differential Revision: https://reviews.freebsd.org/D7980 Modified: head/sys/kern/uipc_socket.c Modified: head/sys/kern/uipc_socket.c ============================================================================== --- head/sys/kern/uipc_socket.c Thu Sep 22 12:08:26 2016 (r306185) +++ head/sys/kern/uipc_socket.c Thu Sep 22 12:41:53 2016 (r306186) @@ -2455,8 +2455,12 @@ sooptcopyin(struct sockopt *sopt, void * */ if ((valsize = sopt->sopt_valsize) < minlen) return EINVAL; - if (valsize > len) + if (valsize > len) { +#if _BYTE_ORDER == _BIG_ENDIAN + sopt->sopt_val = (void *)((uintptr_t)sopt->sopt_val + (valsize - len)); +#endif sopt->sopt_valsize = valsize = len; + } if (sopt->sopt_td != NULL) return (copyin(sopt->sopt_val, buf, valsize));