Skip to content

TC6Regs_CheckTimers NULL pointer issue #26

@Andrewpini

Description

@Andrewpini

Hi, I'm currently working on integration of LAN8651.

During testing I've discovered that TC6Regs_CheckTimers does not seem to check if pReg->pTC6 is a NULL pointer.

How to reproduce:

  • Avoid initializing TC6 registers through TC6Regs_Init().
  • Call TC6Regs_CheckTimers()
  • In my setup I ended up with a deadlock here:
    while(SPI_OP_INVALID != g->currentOp) {};
    (TC6Regs_CheckTimers->DoInitialization->TC6_Reset), caused by g->currentOp containing a garbage value.

The reason why this happens is that avoiding to call TC6Regs_Init() prevents GetContext from ever being called before DoInitialization(), causingpReg->pTC6=NULL, ref:

pReg->pTC6 = pTC6;

Since TC6Regs_CheckTimers() must run periodically, and it will try to use pReg->pTC6 for several operations, it should check that it is a valid pointer.

As a last remark I want to emphasize that I have not done exhaustive testing/investigation of the internals here (yet), but I think it would be prudent to do a thorough investigation to check if/how this applies to other parts of the TC6 implementation.

Regards,

Anders Storrø

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions