From patchwork Sun Sep 17 14:13:52 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Weinberger X-Patchwork-Id: 814653 X-Patchwork-Delegate: cyrille.pitchen@atmel.com Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=none (mailfrom) smtp.mailfrom=lists.infradead.org (client-ip=65.50.211.133; helo=bombadil.infradead.org; envelope-from=linux-mtd-bounces+incoming=patchwork.ozlabs.org@lists.infradead.org; receiver=) Authentication-Results: ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="CNpV+wMn"; dkim-atps=neutral Received: from bombadil.infradead.org (bombadil.infradead.org [65.50.211.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 3xwB3P5rL8z9s83 for ; Mon, 18 Sep 2017 00:14:41 +1000 (AEST) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:MIME-Version:Cc:List-Subscribe: List-Help:List-Post:List-Archive:List-Unsubscribe:List-Id:Message-Id:Date: Subject:To:From:Reply-To:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:In-Reply-To: References:List-Owner; bh=J1soxRQrSqnM7Sx8ZKdcTOWJlPOMbOZ8Pvs1afiVQH0=; b=CNp V+wMnJx/WTULHLtBnFJIzh7vO8ePwD9XswU8ZpTBmigc6PQjXIo3jht7tQg0/n9kS7CgKAHielc0O b1FK7dc3du2t3mbOaiZ0HWIkSxHmOOoo4T+HzZzfXgHBWfdf2cdYc8N5VNltOMxl9T7Syd2mw0ciC jtS7adMBQU7/uV3oloyC6te1dusQeBJLtKmfsnhw6DUrEFZ7JXt+ApXdRRCc8j0PDAPLCKLgQ0uri 7U9idR32PYKxIMRD1PSWSbsXuCu9qwOrfZFdXwP1kjBCIWUD8OAdUiWQ7CUTAKsrK6ahjx0RHexfj cCpmT9pl68ZXEgD9NuIKgInM4Qbg/AA==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.87 #1 (Red Hat Linux)) id 1dtaL6-0000bq-UI; Sun, 17 Sep 2017 14:14:28 +0000 Received: from mail.sigma-star.at ([95.130.255.111]) by bombadil.infradead.org with esmtp (Exim 4.87 #1 (Red Hat Linux)) id 1dtaKf-0000UB-Iz for linux-mtd@lists.infradead.org; Sun, 17 Sep 2017 14:14:05 +0000 Received: from localhost (localhost.localdomain [127.0.0.1]) by mail.sigma-star.at (Postfix) with ESMTP id 0F23924E0011; Sun, 17 Sep 2017 16:13:31 +0200 (CEST) Received: from blindfold.corp.sigma-star.at (richard.vpn.sigmapriv.at [10.3.0.5]) by mail.sigma-star.at (Postfix) with ESMTPSA id 4410F24E0010; Sun, 17 Sep 2017 16:13:30 +0200 (CEST) From: Richard Weinberger To: linux-mtd@lists.infradead.org Subject: [PATCH] mtd: spi-nor: Kill check with no effect Date: Sun, 17 Sep 2017 16:13:52 +0200 Message-Id: <20170917141352.23691-1-richard@nod.at> X-Mailer: git-send-email 2.13.5 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20170917_071401_829001_793F7DDC X-CRM114-Status: GOOD ( 10.68 ) X-Spam-Score: -1.9 (-) X-Spam-Report: SpamAssassin version 3.4.1 on bombadil.infradead.org summary: Content analysis details: (-1.9 points) pts rule name description ---- ---------------------- -------------------------------------------------- -0.0 SPF_PASS SPF: sender matches SPF record -1.9 BAYES_00 BODY: Bayes spam probability is 0 to 1% [score: 0.0000] X-BeenThere: linux-mtd@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: Linux MTD discussion mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: boris.brezillon@free-electrons.com, Richard Weinberger , linux-kernel@vger.kernel.org, marek.vasut@gmail.com, cyrille.pitchen@wedev4u.fr, computersforpeace@gmail.com, dwmw2@infradead.org MIME-Version: 1.0 Sender: "linux-mtd" Errors-To: linux-mtd-bounces+incoming=patchwork.ozlabs.org@lists.infradead.org header.major is of type u8 and cannot be negative. Detected by CoverityScan CID#1417858 ("Integer handling issues") Fixes: f384b352cbf0 ("mtd: spi-nor: parse Serial Flash Discoverable Parameters (SFDP) tables") Signed-off-by: Richard Weinberger Acked-by: Cyrille Pitchen --- Cyrille, I'm not sure what exactly you wanted to test. Maybe it makes sense casting header.major to s8 before checking against < 0? Thanks, //richard --- drivers/mtd/spi-nor/spi-nor.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/drivers/mtd/spi-nor/spi-nor.c b/drivers/mtd/spi-nor/spi-nor.c index d71765739a93..4b86decdf13e 100644 --- a/drivers/mtd/spi-nor/spi-nor.c +++ b/drivers/mtd/spi-nor/spi-nor.c @@ -2252,8 +2252,7 @@ static int spi_nor_parse_sfdp(struct spi_nor *nor, /* Check the SFDP header version. */ if (le32_to_cpu(header.signature) != SFDP_SIGNATURE || - header.major != SFDP_JESD216_MAJOR || - header.minor < SFDP_JESD216_MINOR) + header.major != SFDP_JESD216_MAJOR) return -EINVAL; /*