From patchwork Fri May 18 07:40:52 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Gerd Hoffmann X-Patchwork-Id: 136247 Delivered-To: patch@linaro.org Received: by 2002:a2e:9706:0:0:0:0:0 with SMTP id r6-v6csp907544lji; Fri, 18 May 2018 00:48:20 -0700 (PDT) X-Google-Smtp-Source: AB8JxZo1s027gcwGspnsQJR1eHURJ8floJF3JlsNe7ZPYyIcWM8jhmKdLySBnuS+kjvNPNQnsSg2 X-Received: by 2002:a37:2995:: with SMTP id p21-v6mr7931505qkp.397.1526629700419; Fri, 18 May 2018 00:48:20 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1526629700; cv=none; d=google.com; s=arc-20160816; b=WpGd1/8W79hrG//no+o4MB1+fQTQiNMjkH/5eaBN6qI2zOI8SrbSnByRaDv7YbhORC wqnxsPJYeLWv69oLSSPHoi0Ci1iLls967mzA3b5QDV6qgYkp+nk+R4kN2HT+pAkm3x/Z QvmYidlBihvUiSypYOvcJAw34vFM2ZNpVnEfN5uNwS9ToXKiTRiudi6oE8spTAbaZGpg vAEF7L0ZY4f9NXQYSJknWbPoGn+INbKoxc5tnB6PZKxWa0a1L4W5yOGfQcebLS3+a3hS eFaYU/fbEJegFBwiiFXItDevCdTHZjyI7QPh9JGfUS204+Gvd39B2z10dh9kzkyhyYpj oGjg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:cc:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:subject :content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:to:from:arc-authentication-results; bh=NDBcKpJ6rKTU3RuTPOGoC5POlQIm0UJHNu1TtOMfGoM=; b=Rox5EJY+JoTKs9QRnjpBqI3VfSN3Wxr8GjxFFCv2gAfJwlXT0468d2IfC7oJ22Li4N hByZ+QRzx7zIGjvHSgmADzNyh5pyzn26ULgHoF7xAL6TAMLviw6hBpk1imBqmqZoDKh8 nHAF7/Spn5xfOPvWZN7LpEVZAiF9+mZU0MiKRPBYpLgCA/lluuHi3II++bC0z9SQniau hgY9iJMncRRADHcP51iUMYF4ViBKNY349L+gpij5u6VhxPy9+P92MWvul88h9yomAUD5 ARQPqec/xIoYuFPsowl0bP3w37zPpr+hFLgf8WZ2AFbBHGCPgdjaZ9G/y4cvesgLK2D9 e1Dg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 2001:4830:134:3::11 as permitted sender) smtp.mailfrom=qemu-devel-bounces+patch=linaro.org@nongnu.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from lists.gnu.org (lists.gnu.org. [2001:4830:134:3::11]) by mx.google.com with ESMTPS id x76-v6si3067062qkb.259.2018.05.18.00.48.20 for (version=TLS1 cipher=AES128-SHA bits=128/128); Fri, 18 May 2018 00:48:20 -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; Authentication-Results: mx.google.com; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 2001:4830:134:3::11 as permitted sender) smtp.mailfrom=qemu-devel-bounces+patch=linaro.org@nongnu.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: from localhost ([::1]:37185 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fJa7f-0007G7-VM for patch@linaro.org; Fri, 18 May 2018 03:48:19 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:47296) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fJa0X-0001tg-3C for qemu-devel@nongnu.org; Fri, 18 May 2018 03:40:58 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1fJa0U-00052v-0h for qemu-devel@nongnu.org; Fri, 18 May 2018 03:40:57 -0400 Received: from mx3-rdu2.redhat.com ([66.187.233.73]:60610 helo=mx1.redhat.com) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1fJa0T-00052l-SC for qemu-devel@nongnu.org; Fri, 18 May 2018 03:40:53 -0400 Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.rdu2.redhat.com [10.11.54.4]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 7213D4201AEE; Fri, 18 May 2018 07:40:53 +0000 (UTC) Received: from sirius.home.kraxel.org (ovpn-116-193.ams2.redhat.com [10.36.116.193]) by smtp.corp.redhat.com (Postfix) with ESMTP id 25B0A2024CBC; Fri, 18 May 2018 07:40:53 +0000 (UTC) Received: by sirius.home.kraxel.org (Postfix, from userid 1000) id 973123F11D; Fri, 18 May 2018 09:40:52 +0200 (CEST) From: Gerd Hoffmann To: qemu-devel@nongnu.org Date: Fri, 18 May 2018 09:40:52 +0200 Message-Id: <20180518074052.31724-4-kraxel@redhat.com> In-Reply-To: <20180518074052.31724-1-kraxel@redhat.com> References: <20180518074052.31724-1-kraxel@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.78 on 10.11.54.4 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.11.55.7]); Fri, 18 May 2018 07:40:53 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.5.16 (mx1.redhat.com [10.11.55.7]); Fri, 18 May 2018 07:40:53 +0000 (UTC) for IP:'10.11.54.4' DOMAIN:'int-mx04.intmail.prod.int.rdu2.redhat.com' HELO:'smtp.corp.redhat.com' FROM:'kraxel@redhat.com' RCPT:'' X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 66.187.233.73 Subject: [Qemu-devel] [PULL 3/3] sdl: Move use of surface pointer below check for whether it is NULL 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: Peter Maydell , Gerd Hoffmann Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" From: Peter Maydell In commit 2ab858c6c38ee1 we added a use of the 'surf' variable in sdl2_2d_update() that was unfortunately placed above the early-exit-if-NULL check. Move it to where it ought to be. Fixes: Coverity CID 1390598 Signed-off-by: Peter Maydell Reviewed-by: Philippe Mathieu-Daudé Message-id: 20180515185814.1374-1-peter.maydell@linaro.org Signed-off-by: Gerd Hoffmann --- ui/sdl2-2d.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) -- 2.9.3 diff --git a/ui/sdl2-2d.c b/ui/sdl2-2d.c index 1f34817bae..85484407be 100644 --- a/ui/sdl2-2d.c +++ b/ui/sdl2-2d.c @@ -36,9 +36,7 @@ void sdl2_2d_update(DisplayChangeListener *dcl, struct sdl2_console *scon = container_of(dcl, struct sdl2_console, dcl); DisplaySurface *surf = qemu_console_surface(dcl->con); SDL_Rect rect; - size_t surface_data_offset = surface_bytes_per_pixel(surf) * x + - surface_stride(surf) * y; - + size_t surface_data_offset; assert(!scon->opengl); if (!surf) { @@ -48,6 +46,8 @@ void sdl2_2d_update(DisplayChangeListener *dcl, return; } + surface_data_offset = surface_bytes_per_pixel(surf) * x + + surface_stride(surf) * y; rect.x = x; rect.y = y; rect.w = w;