svn commit: r308920 - stable/9/sys/kern

Konstantin Belousov kib at FreeBSD.org
Mon Nov 21 10:49:38 UTC 2016


Author: kib
Date: Mon Nov 21 10:49:37 2016
New Revision: 308920
URL: https://svnweb.freebsd.org/changeset/base/308920

Log:
  MFC r308642:
  Initialize reserved bytes in struct mq_attr.
  
  PR:	214488

Modified:
  stable/9/sys/kern/uipc_mqueue.c
Directory Properties:
  stable/9/   (props changed)
  stable/9/sys/   (props changed)

Modified: stable/9/sys/kern/uipc_mqueue.c
==============================================================================
--- stable/9/sys/kern/uipc_mqueue.c	Mon Nov 21 10:47:38 2016	(r308919)
+++ stable/9/sys/kern/uipc_mqueue.c	Mon Nov 21 10:49:37 2016	(r308920)
@@ -2177,10 +2177,10 @@ sys_kmq_setattr(struct thread *td, struc
 	}
 	error = kern_kmq_setattr(td, uap->mqd, uap->attr != NULL ? &attr : NULL,
 	    &oattr);
-	if (error != 0)
-		return (error);
-	if (uap->oattr != NULL)
+	if (error == 0 && uap->oattr != NULL) {
+		bzero(oattr.__reserved, sizeof(oattr.__reserved));
 		error = copyout(&oattr, uap->oattr, sizeof(oattr));
+	}
 	return (error);
 }
 
@@ -2707,10 +2707,9 @@ freebsd32_kmq_setattr(struct thread *td,
 	}
 	error = kern_kmq_setattr(td, uap->mqd, uap->attr != NULL ? &attr : NULL,
 	    &oattr);
-	if (error != 0)
-		return (error);
-	if (uap->oattr != NULL) {
+	if (error == 0 && uap->oattr != NULL) {
 		mq_attr_to32(&oattr, &oattr32);
+		bzero(oattr32.__reserved, sizeof(oattr32.__reserved));
 		error = copyout(&oattr32, uap->oattr, sizeof(oattr32));
 	}
 	return (error);


More information about the svn-src-stable-9 mailing list