mirror of
https://github.com/RPCS3/llvm-mirror.git
synced 2024-11-23 19:23:23 +01:00
[RISCV] Fix a potential issue in shouldInsertFixupForCodeAlign()
The bool result of shouldInsertExtraNopBytesForCodeAlign() is not checked but the returned nop count is unconditionally read even though it could be uninitialized. Differential Revision: https://reviews.llvm.org/D63285 Patch by Edward Jones. llvm-svn: 366175
This commit is contained in:
parent
8e05833474
commit
066798ae68
@ -329,11 +329,10 @@ bool RISCVAsmBackend::shouldInsertFixupForCodeAlign(MCAssembler &Asm,
|
||||
if (!STI.getFeatureBits()[RISCV::FeatureRelax])
|
||||
return false;
|
||||
|
||||
// Calculate total Nops we need to insert.
|
||||
// Calculate total Nops we need to insert. If there are none to insert
|
||||
// then simply return.
|
||||
unsigned Count;
|
||||
shouldInsertExtraNopBytesForCodeAlign(AF, Count);
|
||||
// No Nop need to insert, simply return.
|
||||
if (Count == 0)
|
||||
if (!shouldInsertExtraNopBytesForCodeAlign(AF, Count) || (Count == 0))
|
||||
return false;
|
||||
|
||||
MCContext &Ctx = Asm.getContext();
|
||||
|
Loading…
Reference in New Issue
Block a user