Skip to content

Commit

Permalink
CHOLMOD: silence CodeQL warnings (all code was safe)
Browse files Browse the repository at this point in the history
  • Loading branch information
DrTimothyAldenDavis committed Oct 29, 2023
1 parent 1af04dd commit 1f17b45
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 6 deletions.
8 changes: 5 additions & 3 deletions CHOLMOD/Cholesky/cholmod_solve.c
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,8 @@ static void perm
)
{
double *Yx, *Yz, *Bx, *Bz ;
Int k2, nk, p, k, j, nrow, ncol, d, dual, dj, j2 ;
Int k2, nk, p, k, j, nrow, ncol, d, dj, j2 ;
size_t dual ;

/* ---------------------------------------------------------------------- */
/* get inputs */
Expand Down Expand Up @@ -532,7 +533,8 @@ static void ptrans
)
{
double *Yx, *Yz, *Bx, *Bz ;
Int k2, nk, p, k, j, nrow, ncol, d, dual, dj, j2 ;
Int k2, nk, p, k, j, nrow, ncol, d, dj, j2 ;
size_t dual ;

/* ---------------------------------------------------------------------- */
/* get inputs */
Expand Down Expand Up @@ -1543,7 +1545,7 @@ int CHOLMOD(solve2) /* returns TRUE on success, FALSE on failure */
#ifndef NSUPERNODAL
/* allocate workspace */
cholmod_dense *E ;
Int dual ;
size_t dual ;
Common->blas_ok = TRUE ;
dual = (L->xtype == CHOLMOD_REAL && B->xtype != CHOLMOD_REAL) ? 2 : 1 ;
Y = CHOLMOD(ensure_dense) (Y_Handle, n, dual*nrhs, n, L->xtype, Common);
Expand Down
2 changes: 1 addition & 1 deletion CHOLMOD/Cholesky/cholmod_spsolve.c
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@ cholmod_sparse *CHOLMOD(spsolve) /* returns the sparse solution X */
block = MIN (nrhs, 4) ;

/* initial size of X is at most 4*n */
nzmax = n*block ;
nzmax = ((size_t) n) * ((size_t) block) ;

X = CHOLMOD(spzeros) (n, nrhs, nzmax, xtype, Common) ;
B4 = CHOLMOD(zeros) (n, block, B->xtype, Common) ;
Expand Down
2 changes: 1 addition & 1 deletion CHOLMOD/Cholesky/t_cholmod_rowfac.c
Original file line number Diff line number Diff line change
Expand Up @@ -157,7 +157,7 @@ static int TEMPLATE (cholmod_rowfac)
* zomplex. Xwork [i] == 0 must hold. */
Wz = Wx + n ; /* size n for zomplex case only */
mark = Common->mark ;
size_t wsize = (L->xtype == CHOLMOD_REAL ? 1:2) * n ;
size_t wsize = (L->xtype == CHOLMOD_REAL ? 1:2) * ((size_t) n) ;
ASSERT (Common->xworkbytes >= wsize * sizeof (Real)) ;

/* ---------------------------------------------------------------------- */
Expand Down
2 changes: 1 addition & 1 deletion CHOLMOD/Utility/t_cholmod_transpose_sym.c
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,7 @@ int CHOLMOD(transpose_sym)
// allocate workspace
//--------------------------------------------------------------------------

CHOLMOD(allocate_work) (0, ((Perm == NULL) ? 1: 2) * n, 0, Common) ;
CHOLMOD(allocate_work) (0, ((Perm == NULL) ? 1: 2) * A->ncol, 0, Common) ;
RETURN_IF_ERROR ;

Int *Wi = (Int *) Common->Iwork ; // size n integers
Expand Down

0 comments on commit 1f17b45

Please sign in to comment.