All of lore.kernel.org
 help / color / mirror / Atom feed
From: Lloyd <lloydkl.tech@gmail.com>
To: kernelnewbies@kernelnewbies.org
Subject: kmalloc - Address is not consecutive
Date: Thu, 19 Aug 2021 16:24:18 +0530	[thread overview]
Message-ID: <CAA10ZTpsOaCmgoTWrvwMVx_CTEZ4eE6-ZkXPp161Vwuj1ApErA@mail.gmail.com> (raw)


[-- Attachment #1.1: Type: text/plain, Size: 686 bytes --]

Hi,

I am trying to print the address of consecutive locations in a
memory allocated using kmalloc. It prints non contiguous addresses! I tried
with kmalloc_array, and  normal array on stack, I got the same  result. May
I know the reason? The code fragment for array and result are given below.

uint8_t MyArray[100]={'0'};
printk(KERN_INFO "\nAddress is-> %p\n",&MyArray[0]);
printk(KERN_INFO "\nAddress is-> %p\n",&MyArray[1]);
printk(KERN_INFO "\nAddress is-> %p\n",&MyArray[2]);


[ 8684.613909]               Address is-> 00000000b3330991
[ 8684.613914]               Address is-> 000000000519068c
[ 8684.613915]               Address is-> 00000000e448ca76


Thanks a lot,
  Lloyd

[-- Attachment #1.2: Type: text/html, Size: 2600 bytes --]

[-- Attachment #2: Type: text/plain, Size: 170 bytes --]

_______________________________________________
Kernelnewbies mailing list
Kernelnewbies@kernelnewbies.org
https://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies

             reply	other threads:[~2021-08-19 10:55 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-08-19 10:54 Lloyd [this message]
2021-08-19 12:16 ` kmalloc - Address is not consecutive wuzhouhui
2021-08-19 13:29   ` ckim
     [not found]   ` <E1mGi6z-0002zV-NE@shelob.surriel.com>
2021-08-19 13:33     ` Lloyd

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=CAA10ZTpsOaCmgoTWrvwMVx_CTEZ4eE6-ZkXPp161Vwuj1ApErA@mail.gmail.com \
    --to=lloydkl.tech@gmail.com \
    --cc=kernelnewbies@kernelnewbies.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.