Skip to content

Commit

Permalink
tpm2: Address Coverity Issue by casting '1' before shift (CID 1470813)
Browse files Browse the repository at this point in the history
Cast the '1' to UINT64 before shifting it.

Since the shift value is always below 32 it would have never exceeded
the 32bit value it was using before the cast.

Signed-off-by: Stefan Berger <stefanb@linux.ibm.com>
  • Loading branch information
stefanberger committed Feb 16, 2022
1 parent 26e0eea commit d78a452
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/tpm2/NVMarshal.c
Original file line number Diff line number Diff line change
Expand Up @@ -806,7 +806,7 @@ pcrbanks_algs_active(const TPML_PCR_SELECTION *pcrAllocated)
for(i = 0; i < pcrAllocated->count; i++) {
for (j = 0; j < pcrAllocated->pcrSelections[i].sizeofSelect; j++) {
if (pcrAllocated->pcrSelections[i].pcrSelect[j]) {
algs_active |= 1 << pcrAllocated->pcrSelections[i].hash;
algs_active |= ((UINT64)1 << pcrAllocated->pcrSelections[i].hash);
break;
}
}
Expand Down

0 comments on commit d78a452

Please sign in to comment.