From patchwork Tue Aug 19 08:32:58 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Riku Voipio X-Patchwork-Id: 35569 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-pd0-f200.google.com (mail-pd0-f200.google.com [209.85.192.200]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 33DE62136C for ; Tue, 19 Aug 2014 08:44:19 +0000 (UTC) Received: by mail-pd0-f200.google.com with SMTP id w10sf50927495pde.7 for ; Tue, 19 Aug 2014 01:44:18 -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=eXKAH4iepGzOWS0zrUudaidPfBbL5wJAKIE3BWXgkQZdibtRwg+uuZHzjrLbs/mOF+ FjRdsQmXw753kYYFqH9gqV3dMTWZAZmlQjk+W9YOHn0Cjg8JrbPxxzbH+KBmDt6DbOHQ Wr1HWosTBIaflrQZ4ZOaYv95s4RjewLNcF+7/WhTIwqipfRnO4yXBlc2T+l1JLkqvs4Z 9CLygShGnUMJz29oz9ZYZd1R0T+iIjwKYoph3d4Kp+Eucri7RCDvZsYDyJeL13fkxMPA PnGo3qnZkRHgFenFTwnAVQIAUCi7B3k0VTeW8PDdRaaFypnaHZRdETwyb4FeI9OaPCjD aGTQ== X-Gm-Message-State: ALoCoQmeOSbq5Zfam/m0HJV6vMH69c64t99zMAV+h1hpZsG4a90u7rPwQSKN0C4e6+hOOAY1teTG X-Received: by 10.66.187.8 with SMTP id fo8mr22060461pac.32.1408437856286; Tue, 19 Aug 2014 01:44:16 -0700 (PDT) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.140.86.9 with SMTP id o9ls2281180qgd.47.gmail; Tue, 19 Aug 2014 01:44:16 -0700 (PDT) X-Received: by 10.220.250.142 with SMTP id mo14mr21068249vcb.26.1408437856186; Tue, 19 Aug 2014 01:44:16 -0700 (PDT) Received: from mail-vc0-f177.google.com (mail-vc0-f177.google.com [209.85.220.177]) by mx.google.com with ESMTPS id w4si8347281vct.72.2014.08.19.01.44.16 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Tue, 19 Aug 2014 01:44:16 -0700 (PDT) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.220.177 as permitted sender) client-ip=209.85.220.177; Received: by mail-vc0-f177.google.com with SMTP id hy4so6936771vcb.22 for ; Tue, 19 Aug 2014 01:44:16 -0700 (PDT) X-Received: by 10.52.142.102 with SMTP id rv6mr4421365vdb.26.1408437856124; Tue, 19 Aug 2014 01:44:16 -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 tc5csp220862vcb; Tue, 19 Aug 2014 01:44:15 -0700 (PDT) X-Received: by 10.140.82.242 with SMTP id h105mr60897661qgd.98.1408437855349; Tue, 19 Aug 2014 01:44:15 -0700 (PDT) Received: from lists.gnu.org (lists.gnu.org. [2001:4830:134:3::11]) by mx.google.com with ESMTPS id 20si753852qgi.67.2014.08.19.01.44.15 for (version=TLSv1 cipher=RC4-SHA bits=128/128); Tue, 19 Aug 2014 01:44:15 -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]:49156 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XJf1a-0002au-UM for patch@linaro.org; Tue, 19 Aug 2014 04:44:14 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:57437) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XJeqw-00017A-3i for qemu-devel@nongnu.org; Tue, 19 Aug 2014 04:33:24 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1XJeqm-0001b5-2P for qemu-devel@nongnu.org; Tue, 19 Aug 2014 04:33:14 -0400 Received: from afflict.kos.to ([92.243.29.197]:35150) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XJeql-0001YP-Sa for qemu-devel@nongnu.org; Tue, 19 Aug 2014 04:33:04 -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 968EB26698; Tue, 19 Aug 2014 10:33:02 +0200 (CEST) From: riku.voipio@linaro.org To: Peter Maydell , qemu-devel@nongnu.org Date: Tue, 19 Aug 2014 11:32:58 +0300 Message-Id: <8349027af60e861fcc401c928eb76f9f418815d7.1408436940.git.riku.voipio@linaro.org> 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: zhanghailiang Subject: [Qemu-devel] [PULL v2 23/23] 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.177 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));