Commit graph

2 commits

Author SHA1 Message Date
Himanshu Jha
817f4b374f coccinelle: Suppress reports/warnings for ext/
The following addition `depends on !(file in "ext")` allows
to exclude `ext/` warnings reported by coccinelle scripts.

Signed-off-by: Himanshu Jha <himanshujha199640@gmail.com>
2018-11-14 19:20:34 -05:00
Himanshu Jha
58781d5782 coccinelle: Add script to check legal usage of sizeof expression
sizeof when applied to a pointer typed expression gives the size of
the pointer and not the size of the object associated with the pointer
expression leading to errors.

This scripts checks for inconsistencies where sizeof is incorrectly
used, especially while calculating size of memory to be allocated in
memory allocating functions.

Eg:

-	memset(pStr, 0, sizeof(pStr));
+	memset(pStr, 0, sizeof(*pStr));

Signed-off-by: Himanshu Jha <himanshujha199640@gmail.com>
2018-11-07 10:34:24 -05:00