*new* kmalloc_wrong_size: checks the element size for an array
commit3c32da701e3181f1689b186a58f390c8afe2a7d2
authorDan Carpenter <dan.carpenter@oracle.com>
Mon, 20 Feb 2012 14:15:51 +0000 (20 17:15 +0300)
committerDan Carpenter <dan.carpenter@oracle.com>
Mon, 20 Feb 2012 14:15:51 +0000 (20 17:15 +0300)
treea84730f22b5686504e0b60eef4ef797bbe2722dc
parenta6cb6c767f0a9bba17751243e69285233765a25d
*new* kmalloc_wrong_size:  checks the element size for an array

If we have code like:
p = kmalloc(n * sizeof(struct foo), GFP_KERNEL);
and *p is a different size from sizeof(struct foo) then this complains.

It found one bug in the kernel where we changed the type of "p" but forgot
to change the size of the allocation.

Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
check_kmalloc_wrong_size.c [new file with mode: 0644]
check_list.h