[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-devel] [PATCH v6 07/10] linux-user: check return value of mall
From: |
Michael S. Tsirkin |
Subject: |
Re: [Qemu-devel] [PATCH v6 07/10] linux-user: check return value of malloc() |
Date: |
Mon, 18 Aug 2014 22:17:52 +0200 |
On Thu, Aug 14, 2014 at 04:31:35PM +0300, Riku Voipio wrote:
> On Thu, Aug 14, 2014 at 03:29:18PM +0800, zhanghailiang wrote:
> > Signed-off-by: zhanghailiang <address@hidden>
> > Acked-by: Riku Voipio <address@hidden>
>
> Applied to linux-user as Michael seemed wary of passing these via
> trivial.
>
> Riku
Pls remember to add Cc qemu-trivial on bugfixes in your tree.
> >---
> > linux-user/syscall.c | 4 ++++
> > 1 file changed, 4 insertions(+)
> >
> > diff --git a/linux-user/syscall.c b/linux-user/syscall.c
> > index a50229d..8e5ccf1 100644
> > --- a/linux-user/syscall.c
> > +++ b/linux-user/syscall.c
> > @@ -2870,6 +2870,10 @@ static inline abi_long do_msgsnd(int msqid, abi_long
> > msgp,
> > if (!lock_user_struct(VERIFY_READ, target_mb, msgp, 0))
> > return -TARGET_EFAULT;
> > host_mb = malloc(msgsz+sizeof(long));
> > + if (!host_mb) {
> > + unlock_user_struct(target_mb, msgp, 0);
> > + return -TARGET_ENOMEM;
> > + }
> > host_mb->mtype = (abi_long) tswapal(target_mb->mtype);
> > memcpy(host_mb->mtext, target_mb->mtext, msgsz);
> > ret = get_errno(msgsnd(msqid, host_mb, msgsz, msgflg));
> > --
> > 1.7.12.4
> >
> >
- [Qemu-devel] [PATCH v6 05/10] util/path: Use the GLib memory allocation routines, (continued)
- [Qemu-devel] [PATCH v6 05/10] util/path: Use the GLib memory allocation routines, zhanghailiang, 2014/08/14
- [Qemu-devel] [PATCH v6 06/10] slirp/misc: Use g_malloc() instead of malloc(), zhanghailiang, 2014/08/14
- [Qemu-devel] [PATCH v6 07/10] linux-user: check return value of malloc(), zhanghailiang, 2014/08/14
- [Qemu-devel] [PATCH v6 04/10] ivshmem: check the value returned by fstat(), zhanghailiang, 2014/08/14
- [Qemu-devel] [PATCH v6 03/10] virtio-blk: fix reference a pointer which might be freed, zhanghailiang, 2014/08/14
- Re: [Qemu-devel] [Qemu-trivial] [PATCH v6 03/10] virtio-blk: fix reference a pointer which might be freed, Michael Tokarev, 2014/08/18