Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 21 Nov 2016 10:49:37 +0000 (UTC)
From:      Konstantin Belousov <kib@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org
Subject:   svn commit: r308920 - stable/9/sys/kern
Message-ID:  <201611211049.uALAnbNB003028@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
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);



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201611211049.uALAnbNB003028>