You can see that it's doing a dereference on the pointer before calling
sizeof.
Removing the double dereference to just sizeof(*ctx) by creating a pointer
variable does not silence the error either. Storing the result of the
sizeof in a variable then dividing on another line does silence the error.
Hello cppcheck community,
Thanks for your wonderful tool, but I think I found an error in pointer
checking. I am getting the following output
/home/curtis/sof/sof/src/drivers/imx/sdma.c:258:21: warning:inconclusive:
Division of result of sizeof() on pointer type. [divideSizeof]
/home/curtis/sof/sof/src/drivers/imx/sdma.c:259:7: warning:inconclusive:
Division of result of sizeof() on pointer type. [divideSizeof]
/home/curtis/sof/sof/src/drivers/imx/sdma.c:275:7: warning:inconclusive:
Division of result of sizeof() on pointer type. [divideSizeof]
/home/curtis/sof/sof/src/drivers/imx/sdma.c:291:6: warning:inconclusive:
Division of result of sizeof() on pointer type. [divideSizeof]
But when you look at the code
https://github.com/thesofproject/sof/blob/master/src/drivers/imx/sdma.c#L258
You can see that it's doing a dereference on the pointer before calling
sizeof.
Removing the double dereference to just sizeof(*ctx) by creating a pointer
variable does not silence the error either. Storing the result of the
sizeof in a variable then dividing on another line does silence the error.
Tested on latest 2.3 release.
Thanks in advance.
Here is a reduced snippet that still gives the warning:
Thanks for the report. I have created a ticket: https://trac.cppcheck.net/ticket/10179