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:
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ø
Hi, I'm currently working on integration of LAN8651.
During testing I've discovered that TC6Regs_CheckTimers does not seem to check if
pReg->pTC6is a NULL pointer.How to reproduce:
TC6Regs_Init().TC6Regs_CheckTimers()oa-tc6-lib/libtc6/src/tc6.c
Line 237 in 8cc5240
g->currentOpcontaining 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:oa-tc6-lib/libtc6/src/tc6-regs.c
Line 214 in 8cc5240
Since
TC6Regs_CheckTimers()must run periodically, and it will try to usepReg->pTC6for 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ø