login
Header Space

 
 

PAGE_ALIGN after kmalloc

April 30, 2008 - 4:22am
Submitted by Anonymous on April 30, 2008 - 4:22am.
Linux

suppose I alloc memory with kmalloc which isn't guaranteed to be aligned, and then I align it with PAGE_ALIGN macro. Is it possible I'll encounter segmantation fault if I'll access the last allocated byte (for example)?

int *p;
p = (int*) kmalloc(1 << 16, GFP_KERNEL);
PAGE_ALIGN(p);
p[(1 << 16) - 1] = 1;

Thanks.

allocate pages

April 30, 2008 - 8:00am

> suppose I alloc memory with kmalloc which isn't guaranteed to be aligned

__get_free_pages()

(btw, code and question seems odd)

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.
speck-geostationary