Linux - GeneralThis Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then this is the place.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
It seems to me that kmalloc function in my code is returning overlapped memory. In my code a process from the user space calls a function in the kernel space (driver code). The kernel space function allocates memory as part of this kernel space function execution. The process in the user space calls the kernel space driver function twice consecutively. The kmalloc call get called twice (one for each invocation of the kernel space function). The kmalloc call allocates a memory of size 2592 bytes( a structure of this size). I noticed that in the 2nd invocation of the kmalloc, it returns a memory space which overlapped with the first time kmalloc call. I have logged the first byte address and last byte address of the structure allocated in the /var/log/message. Below is the address that I got on both the times:
Fist time kamalloc:
*createFcpTapeDriveCB, 1st address: 0xf5dbc800, 2nd address: 0xf5dbd220, size: 2592 *
*createFcpTapeDriveCB, last address: 0xf5dbd21c *
2nd time kmalloc:
*createFcpTapeDriveCB, 1st address: 0xf5dbc200, 2nd address: 0xf5dbcc20, size: 2592 *
*createFcpTapeDriveCB, last address: 0xf5dbcc1c *
Here the last address: is the address of the last variable in the structure (a 32 bit pointer). 1st address is the address of the first variable in the structure and 2nd address is the first address + sizeof(structure allocated).
Can anybody help me in this regard? Why kmalloc returns overlapped address? I am running kernel version:
[root@indigo2 fcpTape]# uname -a
Linux indigo2 2.4.19smp #3 SMP Mon Jun 16 23:25:54 IST 2003 i686 unknown
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.