svn commit: r306186 - head/sys/kern
Ruslan Bukin
br at FreeBSD.org
Thu Sep 22 12:41:55 UTC 2016
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));
More information about the svn-src-all
mailing list