From patchwork Fri Aug 15 11:01:42 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Riku Voipio X-Patchwork-Id: 35446 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-oi0-f70.google.com (mail-oi0-f70.google.com [209.85.218.70]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 3A4B4203C5 for ; Fri, 15 Aug 2014 11:12:41 +0000 (UTC) Received: by mail-oi0-f70.google.com with SMTP id u20sf11616572oif.5 for ; Fri, 15 Aug 2014 04:12:40 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:delivered-to:from:to:date :message-id:in-reply-to:references:cc:subject:precedence:list-id :list-unsubscribe:list-archive:list-post:list-help:list-subscribe :errors-to:sender:x-original-sender :x-original-authentication-results:mailing-list; bh=uKjb0WyVep2aZEP/XLWYcheA4s40b80jppHlF+PxrJ0=; b=juK46As/6OOLW85r0a8+J3MKQBScTRVvwTIL3wy9E5fCpbQq0Pf1BLP3sza5nyv6C1 Iv3x+SchMmyeugg3mfLnuPr52K5re37aTJw+IhU3MP6vreoiA3iL6jW4vr1NxF48J2fY aOoXsKiRSCVfykFxk9urZqI3YMmECVdtE9OqsQbOROEewAdyQZJw2rqQWnI09emjxs69 UY7LHRDx8oCr6zlKA6vQhJ+Cnu+0CnOMkNTqg9R8HVakaYZKmxq2PZmttbnzCAJGLdTp x77qe2x51le9fx0IFW67L1ck+TMINsnrt0oMWiakMLSH3kAEJ+KBB5tGhFckg18SyKO3 8kng== X-Gm-Message-State: ALoCoQmY8hGdVs+/+NlEdly+ija9NYWND6mxwmnK4M9hfj/TNntlgScz5EFXZzUtnKM6p12H7/Eo X-Received: by 10.182.125.68 with SMTP id mo4mr18929obb.49.1408101160861; Fri, 15 Aug 2014 04:12:40 -0700 (PDT) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.140.100.242 with SMTP id s105ls1333950qge.42.gmail; Fri, 15 Aug 2014 04:12:40 -0700 (PDT) X-Received: by 10.229.191.2 with SMTP id dk2mr26415915qcb.8.1408101160774; Fri, 15 Aug 2014 04:12:40 -0700 (PDT) Received: from mail-vc0-f173.google.com (mail-vc0-f173.google.com [209.85.220.173]) by mx.google.com with ESMTPS id r2si11342335qat.110.2014.08.15.04.12.40 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Fri, 15 Aug 2014 04:12:40 -0700 (PDT) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.220.173 as permitted sender) client-ip=209.85.220.173; Received: by mail-vc0-f173.google.com with SMTP id hy10so2761954vcb.4 for ; Fri, 15 Aug 2014 04:12:40 -0700 (PDT) X-Received: by 10.52.97.233 with SMTP id ed9mr12992694vdb.16.1408101160502; Fri, 15 Aug 2014 04:12:40 -0700 (PDT) X-Forwarded-To: patchwork-forward@linaro.org X-Forwarded-For: patch@linaro.org patchwork-forward@linaro.org Delivered-To: patch@linaro.org Received: by 10.221.37.5 with SMTP id tc5csp104597vcb; Fri, 15 Aug 2014 04:12:40 -0700 (PDT) X-Received: by 10.224.5.137 with SMTP id 9mr1661714qav.3.1408101159529; Fri, 15 Aug 2014 04:12:39 -0700 (PDT) Received: from lists.gnu.org (lists.gnu.org. [2001:4830:134:3::11]) by mx.google.com with ESMTPS id m11si11332599qax.129.2014.08.15.04.12.39 for (version=TLSv1 cipher=RC4-SHA bits=128/128); Fri, 15 Aug 2014 04:12:39 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 2001:4830:134:3::11 as permitted sender) client-ip=2001:4830:134:3::11; Received: from localhost ([::1]:58642 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XIFR1-0005to-25 for patch@linaro.org; Fri, 15 Aug 2014 07:12:39 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:39479) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XIFGg-0004xP-T3 for qemu-devel@nongnu.org; Fri, 15 Aug 2014 07:02:08 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1XIFGV-00073o-BE for qemu-devel@nongnu.org; Fri, 15 Aug 2014 07:01:58 -0400 Received: from afflict.kos.to ([92.243.29.197]:57584) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XIFGV-00071E-4k for qemu-devel@nongnu.org; Fri, 15 Aug 2014 07:01:47 -0400 Received: from afflict.kos.to (afflict [92.243.29.197]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by afflict.kos.to (Postfix) with ESMTPSA id 8ACC0266ED; Fri, 15 Aug 2014 13:01:45 +0200 (CEST) From: riku.voipio@linaro.org To: qemu-devel@nongnu.org Date: Fri, 15 Aug 2014 14:01:42 +0300 Message-Id: X-Mailer: git-send-email 1.7.10.4 In-Reply-To: References: X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x X-Received-From: 92.243.29.197 Cc: Peter Maydell , zhanghailiang Subject: [Qemu-devel] [PULL 24/24] linux-user: check return value of malloc() X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: , List-Help: , List-Subscribe: , Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: qemu-devel-bounces+patch=linaro.org@nongnu.org X-Removed-Original-Auth: Dkim didn't pass. X-Original-Sender: riku.voipio@linaro.org X-Original-Authentication-Results: mx.google.com; spf=pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.220.173 as permitted sender) smtp.mail=patch+caf_=patchwork-forward=linaro.org@linaro.org Mailing-list: list patchwork-forward@linaro.org; contact patchwork-forward+owners@linaro.org X-Google-Group-Id: 836684582541 From: zhanghailiang Signed-off-by: zhanghailiang Acked-by: Riku Voipio Signed-off-by: Riku Voipio --- linux-user/syscall.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/linux-user/syscall.c b/linux-user/syscall.c index 3b1beff..3aaed81 100644 --- a/linux-user/syscall.c +++ b/linux-user/syscall.c @@ -2904,6 +2904,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));