From patchwork Mon Jul 31 10:21:33 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Michael Tokarev X-Patchwork-Id: 795704 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=nongnu.org (client-ip=2001:4830:134:3::11; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) Received: from lists.gnu.org (lists.gnu.org [IPv6:2001:4830:134:3::11]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 3xLc126R66z9s0g for ; Mon, 31 Jul 2017 21:00:06 +1000 (AEST) Received: from localhost ([::1]:58731 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dc8Qe-0006tq-Q2 for incoming@patchwork.ozlabs.org; Mon, 31 Jul 2017 07:00:04 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:60655) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dc8Nw-0004tE-TU for qemu-devel@nongnu.org; Mon, 31 Jul 2017 06:57:18 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1dc8Ns-0004hO-Q3 for qemu-devel@nongnu.org; Mon, 31 Jul 2017 06:57:16 -0400 Received: from isrv.corpit.ru ([86.62.121.231]:36261) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dc8Ns-0004et-Ha; Mon, 31 Jul 2017 06:57:12 -0400 Received: from tsrv.corpit.ru (tsrv.tls.msk.ru [192.168.177.2]) by isrv.corpit.ru (Postfix) with ESMTP id 358CD42AC4; Mon, 31 Jul 2017 13:57:09 +0300 (MSK) Received: from tls.msk.ru (mjt.vpn.tls.msk.ru [192.168.177.99]) by tsrv.corpit.ru (Postfix) with SMTP id 861A3B83; Mon, 31 Jul 2017 13:21:45 +0300 (MSK) Received: (nullmailer pid 5567 invoked by uid 1000); Mon, 31 Jul 2017 10:21:45 -0000 From: Michael Tokarev To: qemu-devel@nongnu.org Date: Mon, 31 Jul 2017 13:21:33 +0300 Message-Id: <72cd500b725fd9a3bbefeb468d54c192fdc28318.1501496349.git.mjt@msgid.tls.msk.ru> X-Mailer: git-send-email 2.11.0 In-Reply-To: References: In-Reply-To: References: MIME-Version: 1.0 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 86.62.121.231 Subject: [Qemu-devel] [PULL 14/25] linux-user/sh4: fix incorrect memory write X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: qemu-trivial@nongnu.org, Michael Tokarev , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" From: Philippe Mathieu-Daudé not hit since 2009! :) linux-user/elfload.c:1102:20: warning: Out of bound memory access (access exceeds upper limit of memory block) (*regs[i]) = tswap32(env->gregs[i]); ~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~ Reported-by: Clang Static Analyzer Signed-off-by: Philippe Mathieu-Daudé Reviewed-by: Laurent Vivier Signed-off-by: Michael Tokarev --- linux-user/elfload.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/linux-user/elfload.c b/linux-user/elfload.c index 2a902f7806..79062882ba 100644 --- a/linux-user/elfload.c +++ b/linux-user/elfload.c @@ -1099,7 +1099,7 @@ static inline void elf_core_copy_regs(target_elf_gregset_t *regs, int i; for (i = 0; i < 16; i++) { - (*regs[i]) = tswapreg(env->gregs[i]); + (*regs)[i] = tswapreg(env->gregs[i]); } (*regs)[TARGET_REG_PC] = tswapreg(env->pc);