Received: by 2002:a05:6a10:9e8c:0:0:0:0 with SMTP id y12csp278154pxx; Wed, 28 Oct 2020 04:50:44 -0700 (PDT) X-Google-Smtp-Source: ABdhPJywM+4tUh6cj4qoAlTwNId4n5nng4HuA7P/b2OoDvGt86r6dTN5470K65NUIcc94wa0OnZV X-Received: by 2002:a50:fe05:: with SMTP id f5mr2021864edt.366.1603885844066; Wed, 28 Oct 2020 04:50:44 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1603885844; cv=none; d=google.com; s=arc-20160816; b=k4s+17OXbqXOl7n2Vn13RQxYm1usBmYcuvn0oQzZtKMXJ+zMydAmbn7Gmrz8iigCQ/ KoLSeTuWTJLe1Ar1lV8IosC7+xy6PXF1XVsBtqAfKeVMggaFNibcegMXa5aI4ZkVfMby mOmWfjihjTAxede9Nl3SXZ8tLweyw5F8Q/4SaJzgr5M6FR13NZ+y2luDfkqXR9F42GJh 4Z+NdgI8ODkVKpr6aRdxXb+7/LzudbftU/O17fZE30ygKZQb2RnLBCF8OC10ooyPdrXF jSXUAwvhb3vBBRNr04WeV0D5ZBQBUca9r0HLhCA6/loL5w3yGTNjmWqh1Lh8T6EkmF+t dVQA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=jTFGf+ofIwB5SzalbtfMD71ZwZVmZw5HhpMU9V/hvaI=; b=FPvTbme7yI3J0bL9BrZsoiR0QsQonIt8sFBBNTmCkOIjA+J+9K9Me5A1wC+4P/zfGa W/NT6VikcpCCg5XJ73d2nvxc7CFhoiQYZvRRfosQCn9hrSizmUXBca16tAcElwnLyBRb +HLPptR4hRuMbdvEJEt7JOg6vmJcQabgntF2MO6oZ4NYviPurPam4uBp/cTQtWelzo3L GaK87+JO0C3FE+0AD2vUX30x74oQyysvPCrBOlGmUuCdUqft9jxz6rOML3m4Zkzlfd29 JUz6Z7vpE6CAKzC7XzmC9MAcpowjrXyO5djkceQb7kD3ujii1k8hEtkL2AKn/VVj0IGX gE5g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=vPhbelA8; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id f19si2736409edx.542.2020.10.28.04.50.17; Wed, 28 Oct 2020 04:50:44 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=vPhbelA8; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1794608AbgJ0PMj (ORCPT + 99 others); Tue, 27 Oct 2020 11:12:39 -0400 Received: from mail.kernel.org ([198.145.29.99]:40084 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1791000AbgJ0PFo (ORCPT ); Tue, 27 Oct 2020 11:05:44 -0400 Received: from localhost (83-86-74-64.cable.dynamic.v4.ziggo.nl [83.86.74.64]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 2E0F121D24; Tue, 27 Oct 2020 15:05:42 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1603811143; bh=l4vVEA+YL8NQ1DFUC4El5nHkJVhc94FNNUke2RJ9F4k=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=vPhbelA8A9+Esjgm9qiaNcz9NgAVzv7gXMYEWVlUyKdFlQvZ8zkMTA20ZGwJV8jDm UN9uOU3poua5HQXGptf8ksAgqNB5u0tFPh36Q2Pgq5VJdc4oN6iaWavN1MbbMPTTiL vOtVkniopqbzdDMeV6LIg4uF3iNipCAF026cD+6c= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Christophe Kerello , Miquel Raynal , Sasha Levin Subject: [PATCH 5.8 389/633] mtd: rawnand: stm32_fmc2: fix a buffer overflow Date: Tue, 27 Oct 2020 14:52:12 +0100 Message-Id: <20201027135540.951081132@linuxfoundation.org> X-Mailer: git-send-email 2.29.1 In-Reply-To: <20201027135522.655719020@linuxfoundation.org> References: <20201027135522.655719020@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Christophe Kerello [ Upstream commit ab16f54ef3cdb6bbc06a36f636a89e6db8a6cea3 ] This patch solves following static checker warning: drivers/mtd/nand/raw/stm32_fmc2_nand.c:350 stm32_fmc2_nfc_select_chip() error: buffer overflow 'nfc->data_phys_addr' 2 <= 2 The CS value can only be 0 or 1. Signed-off-by: Christophe Kerello Fixes: 2cd457f328c1 ("mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver") Signed-off-by: Miquel Raynal Link: https://lore.kernel.org/linux-mtd/1595325127-32693-1-git-send-email-christophe.kerello@st.com Signed-off-by: Sasha Levin --- drivers/mtd/nand/raw/stm32_fmc2_nand.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/mtd/nand/raw/stm32_fmc2_nand.c b/drivers/mtd/nand/raw/stm32_fmc2_nand.c index 65c9d17b25a3c..dce6d7a10a364 100644 --- a/drivers/mtd/nand/raw/stm32_fmc2_nand.c +++ b/drivers/mtd/nand/raw/stm32_fmc2_nand.c @@ -1791,7 +1791,7 @@ static int stm32_fmc2_nfc_parse_child(struct stm32_fmc2_nfc *nfc, return ret; } - if (cs > FMC2_MAX_CE) { + if (cs >= FMC2_MAX_CE) { dev_err(nfc->dev, "invalid reg value: %d\n", cs); return -EINVAL; } -- 2.25.1