From f2ba9e96867935dc624ece52573c174612f72825 Mon Sep 17 00:00:00 2001 From: Dina K Nimeh Date: Tue, 10 Aug 2010 20:08:22 -0700 Subject: [PATCH] 6948791 Panics are seen when running EF on sparc in b139 caused by mp_int having flag=0xbaddcafe --- usr/src/common/mpi/mpi.c | 15 ++++++--------- usr/src/common/mpi/mpi.h | 9 ++++----- 2 files changed, 10 insertions(+), 14 deletions(-) diff --git a/usr/src/common/mpi/mpi.c b/usr/src/common/mpi/mpi.c index b16c711e343c..6241dac0a9be 100644 --- a/usr/src/common/mpi/mpi.c +++ b/usr/src/common/mpi/mpi.c @@ -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 @@ mp_err mp_init_size(mp_int *mp, mp_size prec, int kmflag) SIGN(mp) = ZPOS; USED(mp) = 1; ALLOC(mp) = prec; + FLAG(mp) = kmflag; return MP_OKAY; @@ -251,6 +250,7 @@ mp_err mp_copy(const mp_int *from, mp_int *to) /* 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 @@ void s_mp_copy(const mp_digit *sp, mp_digit *dp, mp_size count) /* 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 @@ mp_to_fixlen_octets(const mp_int *mp, unsigned char *str, mp_size length) /*------------------------------------------------------------------------*/ /* HERE THERE BE DRAGONS */ +/* END CSTYLED */ diff --git a/usr/src/common/mpi/mpi.h b/usr/src/common/mpi/mpi.h index c5384df1c12a..79a18a018f8b 100644 --- a/usr/src/common/mpi/mpi.h +++ b/usr/src/common/mpi/mpi.h @@ -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 @@ typedef int mp_sword; #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 @@ mp_size mp_trailing_zeros(const mp_int *mp); #endif /* defined MP_API_COMPATIBLE */ #endif /* _MPI_H */ +/* END CSTYLED */