Skip to content

Commit

Permalink
6948791 Panics are seen when running EF on sparc in b139 caused by mp…
Browse files Browse the repository at this point in the history
…_int having flag=0xbaddcafe
  • Loading branch information
Dina K Nimeh authored and Dina K Nimeh committed Aug 11, 2010
1 parent e8315de commit f2ba9e9
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 14 deletions.
15 changes: 6 additions & 9 deletions usr/src/common/mpi/mpi.c
@@ -1,3 +1,4 @@
/* BEGIN CSTYLED */
/*
* mpi.c
*
Expand Down Expand Up @@ -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"
Expand Down Expand Up @@ -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;

Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -4870,3 +4866,4 @@ mp_to_fixlen_octets(const mp_int *mp, unsigned char *str, mp_size length)

/*------------------------------------------------------------------------*/
/* HERE THERE BE DRAGONS */
/* END CSTYLED */
9 changes: 4 additions & 5 deletions usr/src/common/mpi/mpi.h
@@ -1,3 +1,4 @@
/* BEGIN CSTYLED */
/*
* mpi.h
*
Expand Down Expand Up @@ -40,17 +41,14 @@
*
* ***** 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.
*/

#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"
Expand Down Expand Up @@ -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 */
Expand Down Expand Up @@ -392,3 +390,4 @@ mp_size mp_trailing_zeros(const mp_int *mp);
#endif /* defined MP_API_COMPATIBLE */

#endif /* _MPI_H */
/* END CSTYLED */

0 comments on commit f2ba9e9

Please sign in to comment.