From patchwork Sun Jan 14 22:55:43 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Francisco Iglesias X-Patchwork-Id: 860554 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=) Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.b="RFCmj3Aa"; dkim-atps=neutral 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 3zKX350wDFz9s7G for ; Mon, 15 Jan 2018 09:58:41 +1100 (AEDT) Received: from localhost ([::1]:43863 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1earEd-00053C-9P for incoming@patchwork.ozlabs.org; Sun, 14 Jan 2018 17:58:39 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:41339) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1earCz-0004YV-0l for qemu-devel@nongnu.org; Sun, 14 Jan 2018 17:58:03 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1earBv-0003mw-22 for qemu-devel@nongnu.org; Sun, 14 Jan 2018 17:56:57 -0500 Received: from mail-lf0-x242.google.com ([2a00:1450:4010:c07::242]:46604) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1earBu-0003lO-MX for qemu-devel@nongnu.org; Sun, 14 Jan 2018 17:55:50 -0500 Received: by mail-lf0-x242.google.com with SMTP id a12so11256602lfe.13 for ; Sun, 14 Jan 2018 14:55:50 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id; bh=hM7OFqNuHKSJVEFbGhx6Ghw45UQ0SHGEhTkbfS1qn6A=; b=RFCmj3AaK3ovIz4CQvghoShCESCvY/CM6Jy8o+KnHvwy5T87J0lRX1Ge/+iC8b8J8G BNo75GVRYD9A2Kk/DF7PL9v72jBUikv9BJdAPDz7fJSVJRzZnvuq8RweE5jCZrkaCKPS pS09rmkV6yShmr12pv0gpGNPg202vm479g3mD/VUl5ejgCo8xD6F/NluoJFISWuTdudn CHj1qpuk/L4H7Nm/5uuNh4RejYBrVw1ZxBHe5XCi8PvitoNCJ52Fc+RY5raBvoM/AS79 Rm0oZMZAy82KeRf0EteSQqoQNg35PpWAx8d4H3MyU2bRzZlm4NXDZ3lmPSrlhf1c9aJm 9lMQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id; bh=hM7OFqNuHKSJVEFbGhx6Ghw45UQ0SHGEhTkbfS1qn6A=; b=aZuVzGCWJ+MnC8bg5Jj8wzvnpWtZC4vWhEdz/D72opBbWEe3c3yZozhTAOWxZab1ay Gv6c9wKUlKFoljHL81oWIHcgW9a31zjW88Uwk1VK4sfT9nK1syav7La5/HQj9kYy4O3W Jt4V0ou6+jv3FqgqyI9+2ZGCu4DpblzHIyWqfBAGdca45w00D3tiPi/QrLSdvkVoCBuo P8uYevq80ielc/RP/ocf39OQCSraW/g9r65ihjvhpMNiOySi/u0ycwv1H2Vemz2Ecp20 bvqo4HGv0agAaVFE10xQDLHi0wi+zN1JkqOnrxNZoAn/sHfv1W3w7c6L8I2sPL1D+6bd RMag== X-Gm-Message-State: AKwxytfYtgWSnzwjFAnql3RjVn1Ea5IdxXFcGPMfYadlsG9LCOG3Odzs n5J6OfgHbB2fvVeJXjiM4PEXhF8N X-Google-Smtp-Source: ACJfBotSeWnmJRG2zLiWwY3kvywEoYs/kxwivlBWQZ0uvlht+vupt/WE2klCnQ3vpMlj7mtKeVPJtw== X-Received: by 10.46.126.5 with SMTP id z5mr8317425ljc.84.1515970548716; Sun, 14 Jan 2018 14:55:48 -0800 (PST) Received: from localhost.localdomain ([2a00:801:381:80a7:3ca4:9ab8:1c68:e5d8]) by smtp.gmail.com with ESMTPSA id b76sm767316lfh.90.2018.01.14.14.55.47 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sun, 14 Jan 2018 14:55:48 -0800 (PST) From: Francisco Iglesias To: qemu-devel@nongnu.org Date: Sun, 14 Jan 2018 23:55:43 +0100 Message-Id: <20180114225543.24006-1-frasse.iglesias@gmail.com> X-Mailer: git-send-email 2.9.3 X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2a00:1450:4010:c07::242 Subject: [Qemu-devel] [PATCH] xilinx_spips: Correct usage of an uninitialized local variable 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@linaro.org, edgari@xilinx.com, alistai@xilinx.com, francisco.iglesias@feimtech.se Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" Coverity found that the variable tx_rx in the function xilinx_spips_flush_txfifo was being used uninitialized (CID 1383841). This patch corrects this by always initializing tx_rx to zeros. Signed-off-by: Francisco Iglesias --- hw/ssi/xilinx_spips.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/hw/ssi/xilinx_spips.c b/hw/ssi/xilinx_spips.c index d8187fa..77e1bbe 100644 --- a/hw/ssi/xilinx_spips.c +++ b/hw/ssi/xilinx_spips.c @@ -210,6 +210,8 @@ #define SNOOP_NONE 0xEE #define SNOOP_STRIPING 0 +#define MAX_NUM_EFFECTIVE_BUSSES 2 + static inline int num_effective_busses(XilinxSPIPS *s) { return (s->regs[R_LQSPI_CFG] & LQSPI_CFG_SEP_BUS && @@ -573,7 +575,7 @@ static void xilinx_spips_flush_txfifo(XilinxSPIPS *s) for (;;) { int i; uint8_t tx = 0; - uint8_t tx_rx[num_effective_busses(s)]; + uint8_t tx_rx[MAX_NUM_EFFECTIVE_BUSSES] = { 0 }; uint8_t dummy_cycles = 0; uint8_t addr_length;