From patchwork Mon Oct 16 17:54:49 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: sundeep subbaraya X-Patchwork-Id: 10009539 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 5D89760235 for ; Mon, 16 Oct 2017 18:11:04 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 4D172286D0 for ; Mon, 16 Oct 2017 18:11:04 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 4BA18287B3; Mon, 16 Oct 2017 18:11:04 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.8 required=2.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, FREEMAIL_FROM, RCVD_IN_DNSWL_HI, T_DKIM_INVALID autolearn=ham version=3.3.1 Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id A7E03286D0 for ; Mon, 16 Oct 2017 18:10:53 +0000 (UTC) Received: from localhost ([::1]:34512 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1e49qm-0005lY-LG for patchwork-qemu-devel@patchwork.kernel.org; Mon, 16 Oct 2017 14:10:52 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:34018) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1e49bc-0001Ut-GJ for qemu-devel@nongnu.org; Mon, 16 Oct 2017 13:55:13 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1e49bY-00076O-H6 for qemu-devel@nongnu.org; Mon, 16 Oct 2017 13:55:12 -0400 Received: from mail-pf0-x241.google.com ([2607:f8b0:400e:c00::241]:44731) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1e49bY-00075m-9i; Mon, 16 Oct 2017 13:55:08 -0400 Received: by mail-pf0-x241.google.com with SMTP id x7so16370510pfa.1; Mon, 16 Oct 2017 10:55:08 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id; bh=uPqPsHNo5vHtAHLW1c1c1S9ji/ASsauovRo1JboM1ME=; b=EjDf/3o7c/PpCdER0kf8kOUOD+ztSOj+NIwatkgfrlyRp5yg3gXqMqUkI4D3bOh3WV w1cnXtUGLAU8hBSnmYc1P4sfNtI1LoBHCzGwG+yf2M5l4LM0jGhUL5h7p+zplSVpE/z4 oIc19TnFzYXukPU0j5Y9iXvZkFM7MiWTKvUBeQiS/oN78cNaG6TL/LDW975QWefVu4Ie jeCCFyScXK2loKXJ/KxXWb0X1vNszxstAtpiLQfWhMR0CKnC2pqJj/KOwYC66Kjr9eq2 inoSYb38tw5CKE3QhQ7G7//6efxtn/F8D6dsO/NN5sy3gWjlj1p0oK0Ql/vQKpwC32do egbA== 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=uPqPsHNo5vHtAHLW1c1c1S9ji/ASsauovRo1JboM1ME=; b=Z9TCkTr404238JYUfhf/+N6XEszeCyx8+JwegaDewEhLzvgv/pM/Nc9bDneJEHWq3N 8K2eFjR2K9wWwrgkqMxVqhguuNELIROGU6H27NA7hIMO6VxO08au3Dbk8jPUftG+31nS 0380O900mTGdVEtvE7XHsxn36xpYHRUqDkK6A6oCHyWSmxZtPt/xgjwvaUyJEqcUnj1y uZDZ4c9aW54Oe96U9nIcdK0gmG91kFkPZ6uFO4f0Qkdqpk5lgsLk/sN5nIXm//y7p8Yp rmAYjo3qmCgNwj9xkRAD49zxwEQE+3YW43YCfkcUZxSn5On/mhbW4SnmB5CS+lJgSk12 7S+Q== X-Gm-Message-State: AMCzsaUZDpZ0c1C8MWxdIllkpPH/pkPaPcpj3jxfT8PwJKsJkAt0Ya3I zRbkTqwmGXs/Fe6J4posBWbGfg== X-Google-Smtp-Source: AOwi7QD5K6WwaG1bDhyolAwp/0J45Jwddyw6cqzTscaXzgmWB9amsJaU9quz949gRMoGYu5hcv6Img== X-Received: by 10.101.67.73 with SMTP id k9mr8732776pgq.188.1508176506997; Mon, 16 Oct 2017 10:55:06 -0700 (PDT) Received: from localhost.localdomain ([124.123.70.3]) by smtp.gmail.com with ESMTPSA id m185sm15019579pfm.181.2017.10.16.10.55.03 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Mon, 16 Oct 2017 10:55:06 -0700 (PDT) From: Subbaraya Sundeep To: qemu-devel@nongnu.org, qemu-arm@nongnu.org Date: Mon, 16 Oct 2017 23:24:49 +0530 Message-Id: <1508176489-9002-1-git-send-email-sundeep.lkml@gmail.com> X-Mailer: git-send-email 2.5.0 X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2607:f8b0:400e:c00::241 Subject: [Qemu-devel] [Qemu devel PATCH] msf2: Remove dead code reported by Coverity 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, crosthwaite.peter@gmail.com, f4bug@amsat.org, alistair23@gmail.com, Subbaraya Sundeep , pbonzini@redhat.com, imammedo@redhat.com Errors-To: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: "Qemu-devel" X-Virus-Scanned: ClamAV using ClamSMTP Fixed incorrect frame size mask, validated maximum frame size in spi_write and removed dead code. Signed-off-by: Subbaraya Sundeep --- hw/ssi/mss-spi.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/hw/ssi/mss-spi.c b/hw/ssi/mss-spi.c index 5a8e308..1e49cbc 100644 --- a/hw/ssi/mss-spi.c +++ b/hw/ssi/mss-spi.c @@ -76,9 +76,10 @@ #define C_BIGFIFO (1 << 29) #define C_RESET (1 << 31) -#define FRAMESZ_MASK 0x1F +#define FRAMESZ_MASK 0x3F #define FMCOUNT_MASK 0x00FFFF00 #define FMCOUNT_SHIFT 8 +#define FRAMESZ_MAX 32 static void txfifo_reset(MSSSpiState *s) { @@ -106,8 +107,6 @@ static void set_fifodepth(MSSSpiState *s) s->fifo_depth = 16; } else if (size <= 32) { s->fifo_depth = 8; - } else { - s->fifo_depth = 4; } } @@ -301,6 +300,9 @@ static void spi_write(void *opaque, hwaddr addr, if (s->enabled) { break; } + if ((value & FRAMESZ_MASK) > FRAMESZ_MAX) { + break; + } s->regs[R_SPI_DFSIZE] = value; break;