kfree a pointer "from the middle" causing protection faults

From: Muni Sekhar
Date: Wed Sep 02 2015 - 11:02:22 EST


[ Please keep me in CC as I'm not subscribed to the list]

Hello,


I am getting protection faults in different kernel modules if I try to
free a pointer "from the middle" for example, look at the following
code:


u8 *buf;


buf = kzalloc( 100 , GFP_KERNEL );

â

buf = buf + 50;

â

Kfree(buf);




I would like to know, why the above code is causing protection faults
in other kernel modules?


Regards,
Sekhar
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/