kmalloc - Crashing
Lloyd
lloydkl.tech at gmail.com
Wed Aug 18 07:33:07 EDT 2021
Hi,
I am starting to write linux kernel mode code. I am on Ubuntu 20.04. I have
written the following code
The line DynPage[i]=0; //CRASH causes a crash. Can you please guide on
the reason for the crash?
Thanks a lot in advance,
Lloyd
#pragma GCC push_options
#pragma GCC optimize("O0")
void ClearMem(void)
{
unsigned int* DynPage=NULL;
unsigned int i=0;
DynPage=kmalloc(1024*16,GFP_KERNEL);
if(DynPage!=NULL)
{
DynPage[i]=0; //CRASH
}
kfree(DynPage);
DynPage=NULL;
return;
}
#pragma GCC pop_options
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.kernelnewbies.org/pipermail/kernelnewbies/attachments/20210818/da812a55/attachment.html>
More information about the Kernelnewbies
mailing list