changeset 13078:6cb0e0fdae86

6948791 Panics are seen when running EF on sparc in b139 caused by mp_int having flag=0xbaddcafe
author Dina K Nimeh <Dina.Nimeh@Sun.COM>
date Tue, 10 Aug 2010 20:08:22 -0700
parents 5025f7554e44
children 9c11d9f612c8
files usr/src/common/mpi/mpi.c usr/src/common/mpi/mpi.h
diffstat 2 files changed, 10 insertions(+), 14 deletions(-) [+]
line wrap: on
line diff
--- a/usr/src/common/mpi/mpi.c	Tue Aug 10 19:37:15 2010 -0700
+++ b/usr/src/common/mpi/mpi.c	Tue Aug 10 20:08:22 2010 -0700
@@ -1,3 +1,4 @@
+/* BEGIN CSTYLED */
 /*
  *  mpi.c
  *
@@ -41,14 +42,11 @@
  *
  * ***** END LICENSE BLOCK ***** */
 /*
- * Copyright 2007 Sun Microsystems, Inc.  All rights reserved.
- * Use is subject to license terms.
+ * Copyright (c) 2007, 2010, Oracle and/or its affiliates. All rights reserved.
  *
  * Sun elects to use this software under the MPL license.
  */
 
-#pragma ident	"%Z%%M%	%I%	%E% SMI"
-
 /* $Id: mpi.c,v 1.45 2006/09/29 20:12:21 alexei.volkov.bugs%sun.com Exp $ */
 
 #include "mpi-priv.h"
@@ -160,6 +158,7 @@
   SIGN(mp) = ZPOS;
   USED(mp) = 1;
   ALLOC(mp) = prec;
+  FLAG(mp) = kmflag;
 
   return MP_OKAY;
 
@@ -251,6 +250,7 @@
     /* Copy the precision and sign from the original */
     USED(to) = USED(from);
     SIGN(to) = SIGN(from);
+    FLAG(to) = FLAG(from);
   } /* end copy */
 
   return MP_OKAY;
@@ -2886,13 +2886,9 @@
 /* Allocate ni records of nb bytes each, and return a pointer to that     */
 void    *s_mp_alloc(size_t nb, size_t ni, int kmflag)
 {
-  mp_int *mp;
   ++mp_allocs;
 #ifdef _KERNEL
-  mp = kmem_zalloc(nb * ni, kmflag);
-  if (mp != NULL)
-    FLAG(mp) = kmflag;
-  return (mp);
+  return kmem_zalloc(nb * ni, kmflag);
 #else
   return calloc(nb, ni);
 #endif
@@ -4870,3 +4866,4 @@
 
 /*------------------------------------------------------------------------*/
 /* HERE THERE BE DRAGONS                                                  */
+/* END CSTYLED */
--- a/usr/src/common/mpi/mpi.h	Tue Aug 10 19:37:15 2010 -0700
+++ b/usr/src/common/mpi/mpi.h	Tue Aug 10 20:08:22 2010 -0700
@@ -1,3 +1,4 @@
+/* BEGIN CSTYLED */
 /*
  *  mpi.h
  *
@@ -40,8 +41,7 @@
  *
  * ***** END LICENSE BLOCK ***** */
 /*
- * Copyright 2007 Sun Microsystems, Inc.  All rights reserved.
- * Use is subject to license terms.
+ * Copyright (c) 2007, 2010, Oracle and/or its affiliates. All rights reserved.
  *
  * Sun elects to use this software under the MPL license.
  */
@@ -49,8 +49,6 @@
 #ifndef _MPI_H
 #define _MPI_H
 
-#pragma ident	"%Z%%M%	%I%	%E% SMI"
-
 /* $Id: mpi.h,v 1.22 2004/04/27 23:04:36 gerv%gerv.net Exp $ */
 
 #include "mpi-config.h"
@@ -240,7 +238,7 @@
 #define MP_MAX_RADIX         64
 
 typedef struct {
-  mp_sign       flag;    /* KM_SLEEP/KM_NOSLEEP        */
+  mp_flag       flag;    /* KM_SLEEP/KM_NOSLEEP        */
   mp_sign       sign;    /* sign of this quantity      */
   mp_size       alloc;   /* how many digits allocated  */
   mp_size       used;    /* how many digits used       */
@@ -392,3 +390,4 @@
 #endif /* defined MP_API_COMPATIBLE */
 
 #endif /* _MPI_H */
+/* END CSTYLED */