Language: C
Label: safe
CWE: CWE-665 \u2014 Improper Initialization
The product does not initialize or incorrectly initializes a resource, which might leave the resource in an unexpected state when it is accessed or used.

Code:
OE_INLINE void _handle_oret(
    oe_sgx_td_t* td,
    uint16_t func,
    uint16_t result,
    uint64_t arg)
{
    oe_callsite_t* callsite = td->callsites;

    if (!callsite)
        return;

    td->oret_func = func;
    td->oret_result = result;
    td->oret_arg = arg;

    /* Restore the FXSTATE and flags */
    asm volatile(
        "pushq %[rflags] \n\t" // Restore flags.
        "popfq \n\t"
        "fldcw %[fcw] \n\t"     // Restore x87 control word
        "ldmxcsr %[mxcsr] \n\t" // Restore MXCSR
        "lfence \n\t" // MXCSR Configuration Dependent Timing (MCDT) mitigation
        : [mxcsr] "=m"(callsite->mxcsr),
          [fcw] "=m"(callsite->fcw),
          [rflags] "=m"(callsite->rflags)
        :
        : "cc");

    oe_longjmp(&callsite->jmpbuf, 1);
}