Received: by 2002:a05:6a10:22f:0:0:0:0 with SMTP id 15csp2479682pxk; Mon, 14 Sep 2020 14:46:10 -0700 (PDT) X-Google-Smtp-Source: ABdhPJx92T4y3F7Qm60BjE6CLJhUHmwGMk7CW5yZfycX38oeno8fybmNCJM3s/GGpCbYWNwv/65t X-Received: by 2002:a50:ce09:: with SMTP id y9mr18800693edi.91.1600119970131; Mon, 14 Sep 2020 14:46:10 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1600119970; cv=none; d=google.com; s=arc-20160816; b=yniGWQrnKBiLxcFn73Vx+anij7izXUBZsfNJyJPYYYscYuSPL6duKovZVW4dEAolaD 3qSCKTfABXIMiDI47Vaghvy9iMccNNVRekHM56DZzJfxU9YrCvPpw+Ksf6zQXH2kXix8 wlP72TCs7rOpz3aWj2NHP6a0GTssQXHyflNt63uY/z55BGtQGXoJKBDULlKBB7dkZRbN S7LqIFPdH9E386icMtvxNci+UCyj8j1Vd8ZmEyaCailhvTIc/j0FIzjddI0qsnmBuKBt ymfCgUPx4AkFLoXZVbqb0rlb2aEcM/tDRkhUaXAg8Es0i2hhOAdfsN7Ug5o5KKms8PqW h+EQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:to:content-transfer-encoding:mime-version :message-id:date:subject:cc:from:dkim-signature; bh=bv3jV7gXm2zqMYubAXDmuMLaJFvcfVa1TTcvWO4iJog=; b=qCqSnKdFS/u/mXDPwiaOq6Wn+JLlF6bQdvE4RF0I5mWu7TLXasCobEpWRrqhvQ5GkN /y9SZtxOuGrIhBlzkcjry4OW2QDTZjWlwHYYMC4sLVoXRdJhWd/JcQomSe2JAhIrnA4j iGPhlTbIqCrnCMUiqiUIxqNVg2ykWIObXrd+MYIwLzXlCoul5rZzA/GaRhc7FRsEsUPv YehhO09YRintS9LvNvQf9ft98cv4FOjnp3i748g/oOrUiVYaAtUW+P4HP7Tjkv4SLbMA LoHxFBbN/6QkVeTzO6x9CI/IzzxzuB1oDVuoWuF4iOYbPQEYymFY3cDTE/KKfOwUVXrj jA/Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@gmail.com header.s=20161025 header.b=DXcW4c+s; 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=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id g6si7584260ejx.47.2020.09.14.14.45.47; Mon, 14 Sep 2020 14:46:10 -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=fail header.i=@gmail.com header.s=20161025 header.b=DXcW4c+s; 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=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726043AbgINVm5 (ORCPT + 99 others); Mon, 14 Sep 2020 17:42:57 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48734 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725986AbgINVmw (ORCPT ); Mon, 14 Sep 2020 17:42:52 -0400 Received: from mail-wr1-x442.google.com (mail-wr1-x442.google.com [IPv6:2a00:1450:4864:20::442]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 724F3C06174A for ; Mon, 14 Sep 2020 14:42:52 -0700 (PDT) Received: by mail-wr1-x442.google.com with SMTP id a17so1153628wrn.6 for ; Mon, 14 Sep 2020 14:42:52 -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:mime-version :content-transfer-encoding; bh=bv3jV7gXm2zqMYubAXDmuMLaJFvcfVa1TTcvWO4iJog=; b=DXcW4c+sYUy6WIxjwulWXeTf6DVn8qTz+NUCU9jkOH+38ihpU6hLLfNGZ9wf89DZ41 +Rx4f9Rn9LF1fhSZi9a4Rqw3onUVbcqq1+9erxd0F+b7Dvye1+IooWgGK6Y9yd1Z10nS c1VNJ8ff43OnFXL7TxvC2Po+vQ6gkpAsJr1mZFokBNqkV5Kz1chjJuV0iaFeZjrwsrfY ZPG5zorp0IRMpIlghv4UBYEnrCUEWEEoo7CDpE9W1y59eoFsaTrYvAofbHtyUkQ7nrU7 +qxi150zKvHIe2hNATtt1HDtV992UK5cCZjQyWaHuZu4EFJdvtyw7xXo7STiHnrnvP99 qhiA== 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:mime-version :content-transfer-encoding; bh=bv3jV7gXm2zqMYubAXDmuMLaJFvcfVa1TTcvWO4iJog=; b=s750Xv5eI2Zws0HsTqHzCHsaQ7sh0zbGrcS7bs1nc0neiS04fEk1q6C5UHedbFqbmA M0SLcQDaZzWbw7z49tAX4BsDOQ2C2q7NO0eO5jaK4IlNANmR1Xh3tr4/6q6ABZIklYi3 W4i8MXo0XdKM7AW7RY9b+MtBh/qpVbHn/zu+rBMmNe5pWqtiO+/WV2sskdvhAhCrexsH esx87kOyUc75TZw1Y7FlOlXB7jysb/0bry6QscW3JlfCBjYOyEluA2axOHQ1/Tmzwmp9 WalCj/1zIuwYPYlTi9cfzWMe6zp1OeoUhUUMSBvrVlHh3pvKJfr7WS7d7jHGGNlTmwCy qQ5w== X-Gm-Message-State: AOAM532BcMlYHLk5e1QoRoQCKnlKMCzw2D+hR1L3kW+V67C8hUnOO3Cs PUNnx9mM2owjB1ghy8sfDHA= X-Received: by 2002:adf:efc9:: with SMTP id i9mr18650597wrp.187.1600119771142; Mon, 14 Sep 2020 14:42:51 -0700 (PDT) Received: from localhost.localdomain (cpc83661-brig20-2-0-cust443.3-3.cable.virginm.net. [82.28.105.188]) by smtp.gmail.com with ESMTPSA id h16sm23913899wre.87.2020.09.14.14.42.50 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 14 Sep 2020 14:42:50 -0700 (PDT) From: Alex Dewar Cc: Alex Dewar , Tudor Ambarus , Miquel Raynal , Richard Weinberger , Vignesh Raghavendra , Nicolas Ferre , Alexandre Belloni , Ludovic Desroches , linux-mtd@lists.infradead.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org Subject: [PATCH] mtd: rawnand: atmel: Check return values for nand_read_data_op Date: Mon, 14 Sep 2020 22:42:44 +0100 Message-Id: <20200914214245.14626-1-alex.dewar90@gmail.com> X-Mailer: git-send-email 2.28.0 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit To: unlisted-recipients:; (no To-header on input) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org In atmel_nand_pmecc_read_pg(), nand_read_data_op() is called twice without the return values being checked for errors. Add these checks. Signed-off-by: Alex Dewar --- drivers/mtd/nand/raw/atmel/nand-controller.c | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/drivers/mtd/nand/raw/atmel/nand-controller.c b/drivers/mtd/nand/raw/atmel/nand-controller.c index 309ce410d792..e6ceec8f50dc 100644 --- a/drivers/mtd/nand/raw/atmel/nand-controller.c +++ b/drivers/mtd/nand/raw/atmel/nand-controller.c @@ -948,11 +948,17 @@ static int atmel_nand_pmecc_read_pg(struct nand_chip *chip, u8 *buf, if (ret) return ret; - nand_read_data_op(chip, buf, mtd->writesize, false, false); - nand_read_data_op(chip, chip->oob_poi, mtd->oobsize, false, false); + ret = nand_read_data_op(chip, buf, mtd->writesize, false, false); + if (ret) + goto out_disable; + + ret = nand_read_data_op(chip, chip->oob_poi, mtd->oobsize, false, false); + if (ret) + goto out_disable; ret = atmel_nand_pmecc_correct_data(chip, buf, raw); +out_disable: atmel_nand_pmecc_disable(chip, raw); return ret; -- 2.28.0