All of lore.kernel.org
 help / color / mirror / Atom feed
* [Bug 1894029] [NEW] qemu-i386 malloc error
@ 2020-09-03  4:12 Tony.LI
  2020-09-03  5:16 ` [Bug 1894029] " Michael Tokarev
  2020-09-03  5:57 ` Tony.LI
  0 siblings, 2 replies; 3+ messages in thread
From: Tony.LI @ 2020-09-03  4:12 UTC (permalink / raw)
  To: qemu-devel

Public bug reported:

Hi!I use qemu-i386-static on 64 bit machines.And memory request succeeded, but the pointer is wrong.
This is my test program:

#include <stdint.h>
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>

int main(int argc, char **argv)
{
        void *pa=0,*pb=0,*pc=0,*pd=0;
        pa = malloc(sizeof(uint32_t));
        pb = malloc(sizeof(uint32_t));
        pc = malloc(4);
        pd = malloc(4);
        printf("pa: 0x%x\n",pa);
        printf("pb: 0x%x\n",pb);
        printf("pc: 0x%x\n",pc);
        printf("pd: 0x%x\n",pd);
        printf("uint32_t:%d\n",sizeof(uint32_t));
        free(pa);
        free(pb);
        free(pc);
        free(pd);
        return 0;
}

And it is wrong:

pa: 0x400051a0
pb: 0x400051b0
pc: 0x400051c0
pd: 0x400051d0
uint32_t:4

Why did I apply for 4 bytes of space, but the pointer only increased by 2 bytes??
Is it a BUG??

** Affects: qemu
     Importance: Undecided
         Status: New

-- 
You received this bug notification because you are a member of qemu-
devel-ml, which is subscribed to QEMU.
https://bugs.launchpad.net/bugs/1894029

Title:
  qemu-i386 malloc error

Status in QEMU:
  New

Bug description:
  Hi!I use qemu-i386-static on 64 bit machines.And memory request succeeded, but the pointer is wrong.
  This is my test program:

  #include <stdint.h>
  #include <stdio.h>
  #include <stdlib.h>
  #include <unistd.h>

  int main(int argc, char **argv)
  {
          void *pa=0,*pb=0,*pc=0,*pd=0;
          pa = malloc(sizeof(uint32_t));
          pb = malloc(sizeof(uint32_t));
          pc = malloc(4);
          pd = malloc(4);
          printf("pa: 0x%x\n",pa);
          printf("pb: 0x%x\n",pb);
          printf("pc: 0x%x\n",pc);
          printf("pd: 0x%x\n",pd);
          printf("uint32_t:%d\n",sizeof(uint32_t));
          free(pa);
          free(pb);
          free(pc);
          free(pd);
          return 0;
  }

  And it is wrong:

  pa: 0x400051a0
  pb: 0x400051b0
  pc: 0x400051c0
  pd: 0x400051d0
  uint32_t:4

  Why did I apply for 4 bytes of space, but the pointer only increased by 2 bytes??
  Is it a BUG??

To manage notifications about this bug go to:
https://bugs.launchpad.net/qemu/+bug/1894029/+subscriptions


^ permalink raw reply	[flat|nested] 3+ messages in thread

* [Bug 1894029] Re: qemu-i386 malloc error
  2020-09-03  4:12 [Bug 1894029] [NEW] qemu-i386 malloc error Tony.LI
@ 2020-09-03  5:16 ` Michael Tokarev
  2020-09-03  5:57 ` Tony.LI
  1 sibling, 0 replies; 3+ messages in thread
From: Michael Tokarev @ 2020-09-03  5:16 UTC (permalink / raw)
  To: qemu-devel

Please stop asking questions using a bug tracking system, this is rude.

No it is not a bug, it appears you can't do simple arithmetics, -- the
pointer is increased by 16 bytes not 2.

** Changed in: qemu
       Status: New => Invalid

-- 
You received this bug notification because you are a member of qemu-
devel-ml, which is subscribed to QEMU.
https://bugs.launchpad.net/bugs/1894029

Title:
  qemu-i386 malloc error

Status in QEMU:
  Invalid

Bug description:
  Hi!I use qemu-i386-static on 64 bit machines.And memory request succeeded, but the pointer is wrong.
  This is my test program:

  #include <stdint.h>
  #include <stdio.h>
  #include <stdlib.h>
  #include <unistd.h>

  int main(int argc, char **argv)
  {
          void *pa=0,*pb=0,*pc=0,*pd=0;
          pa = malloc(sizeof(uint32_t));
          pb = malloc(sizeof(uint32_t));
          pc = malloc(4);
          pd = malloc(4);
          printf("pa: 0x%x\n",pa);
          printf("pb: 0x%x\n",pb);
          printf("pc: 0x%x\n",pc);
          printf("pd: 0x%x\n",pd);
          printf("uint32_t:%d\n",sizeof(uint32_t));
          free(pa);
          free(pb);
          free(pc);
          free(pd);
          return 0;
  }

  And it is wrong:

  pa: 0x400051a0
  pb: 0x400051b0
  pc: 0x400051c0
  pd: 0x400051d0
  uint32_t:4

  Why did I apply for 4 bytes of space, but the pointer only increased by 2 bytes??
  Is it a BUG??

To manage notifications about this bug go to:
https://bugs.launchpad.net/qemu/+bug/1894029/+subscriptions


^ permalink raw reply	[flat|nested] 3+ messages in thread

* [Bug 1894029] Re: qemu-i386 malloc error
  2020-09-03  4:12 [Bug 1894029] [NEW] qemu-i386 malloc error Tony.LI
  2020-09-03  5:16 ` [Bug 1894029] " Michael Tokarev
@ 2020-09-03  5:57 ` Tony.LI
  1 sibling, 0 replies; 3+ messages in thread
From: Tony.LI @ 2020-09-03  5:57 UTC (permalink / raw)
  To: qemu-devel

** Description changed:

  Hi!I use qemu-i386-static on 64 bit machines.And memory request succeeded, but the pointer is wrong.
  This is my test program:
  
  #include <stdint.h>
  #include <stdio.h>
  #include <stdlib.h>
  #include <unistd.h>
  
  int main(int argc, char **argv)
  {
-         void *pa=0,*pb=0,*pc=0,*pd=0;
-         pa = malloc(sizeof(uint32_t));
-         pb = malloc(sizeof(uint32_t));
-         pc = malloc(4);
-         pd = malloc(4);
-         printf("pa: 0x%x\n",pa);
-         printf("pb: 0x%x\n",pb);
-         printf("pc: 0x%x\n",pc);
-         printf("pd: 0x%x\n",pd);
-         printf("uint32_t:%d\n",sizeof(uint32_t));
-         free(pa);
-         free(pb);
-         free(pc);
-         free(pd);
-         return 0;
+         void *pa=0,*pb=0,*pc=0,*pd=0;
+         pa = malloc(sizeof(uint32_t));
+         pb = malloc(sizeof(uint32_t));
+         pc = malloc(4);
+         pd = malloc(4);
+         printf("pa: 0x%x\n",pa);
+         printf("pb: 0x%x\n",pb);
+         printf("pc: 0x%x\n",pc);
+         printf("pd: 0x%x\n",pd);
+         printf("uint32_t:%d\n",sizeof(uint32_t));
+         free(pa);
+         free(pb);
+         free(pc);
+         free(pd);
+         return 0;
  }
  
  And it is wrong:
  
  pa: 0x400051a0
  pb: 0x400051b0
  pc: 0x400051c0
  pd: 0x400051d0
  uint32_t:4
  
  Why did I apply for 4 bytes of space, but the pointer only increased by 2 bytes??
  Is it a BUG??

** Description changed:

- Hi!I use qemu-i386-static on 64 bit machines.And memory request succeeded, but the pointer is wrong.
- This is my test program:
- 
- #include <stdint.h>
- #include <stdio.h>
- #include <stdlib.h>
- #include <unistd.h>
- 
- int main(int argc, char **argv)
- {
-         void *pa=0,*pb=0,*pc=0,*pd=0;
-         pa = malloc(sizeof(uint32_t));
-         pb = malloc(sizeof(uint32_t));
-         pc = malloc(4);
-         pd = malloc(4);
-         printf("pa: 0x%x\n",pa);
-         printf("pb: 0x%x\n",pb);
-         printf("pc: 0x%x\n",pc);
-         printf("pd: 0x%x\n",pd);
-         printf("uint32_t:%d\n",sizeof(uint32_t));
-         free(pa);
-         free(pb);
-         free(pc);
-         free(pd);
-         return 0;
- }
- 
- And it is wrong:
- 
- pa: 0x400051a0
- pb: 0x400051b0
- pc: 0x400051c0
- pd: 0x400051d0
- uint32_t:4
- 
- Why did I apply for 4 bytes of space, but the pointer only increased by 2 bytes??
- Is it a BUG??
+ Invalid

-- 
You received this bug notification because you are a member of qemu-
devel-ml, which is subscribed to QEMU.
https://bugs.launchpad.net/bugs/1894029

Title:
  qemu-i386 malloc error

Status in QEMU:
  Invalid

Bug description:
  Invalid

To manage notifications about this bug go to:
https://bugs.launchpad.net/qemu/+bug/1894029/+subscriptions


^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2020-09-03  6:15 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-09-03  4:12 [Bug 1894029] [NEW] qemu-i386 malloc error Tony.LI
2020-09-03  5:16 ` [Bug 1894029] " Michael Tokarev
2020-09-03  5:57 ` Tony.LI

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.