lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [day] [month] [year] [list]
Message-Id: <1470850492-6606-1-git-send-email-arvind.yadav.cs@gmail.com>
Date:	Wed, 10 Aug 2016 23:04:52 +0530
From:	Arvind Yadav <arvind.yadav.cs@...il.com>
To:	broonie@...nel.org, galak@...nel.crashing.com
Cc:	linux-spi@...r.kernel.org, linux-kernel@...r.kernel.org,
	Arvind Yadav <arvind.yadav.cs@...il.com>
Subject: [v.1] spi : spi-fsl :- Error check if cpm_muram_alloc fails and return

cpm_muram_alloc can fail so the returned value should be checked.

Signed-off-by: Arvind Yadav <arvind.yadav.cs@...il.com>
---
 drivers/spi/spi-fsl-cpm.c | 7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/drivers/spi/spi-fsl-cpm.c b/drivers/spi/spi-fsl-cpm.c
index 8f7b26e..1362e2d 100644
--- a/drivers/spi/spi-fsl-cpm.c
+++ b/drivers/spi/spi-fsl-cpm.c
@@ -258,6 +258,9 @@ static unsigned long fsl_spi_cpm_get_pram(struct mpc8xxx_spi *mspi)
 	/* QE but with a dynamic pram location? */
 	if (mspi->flags & SPI_QE) {
 		pram_ofs = cpm_muram_alloc(SPI_PRAM_SIZE, 64);
+		if (IS_ERR_VALUE(pram_ofs))
+			return pram_ofs;
+
 		qe_issue_cmd(QE_ASSIGN_PAGE_TO_DEVICE, mspi->subblock,
 			     QE_CR_PROTOCOL_UNSPECIFIED, pram_ofs);
 		return pram_ofs;
@@ -269,9 +272,13 @@ static unsigned long fsl_spi_cpm_get_pram(struct mpc8xxx_spi *mspi)
 
 	if (mspi->flags & SPI_CPM2) {
 		pram_ofs = cpm_muram_alloc(SPI_PRAM_SIZE, 64);
+		if (IS_ERR_VALUE(pram_ofs))
+			goto error_pram;
+
 		out_be16(spi_base, pram_ofs);
 	}
 
+error_pram:
 	iounmap(spi_base);
 	return pram_ofs;
 }
-- 
2.7.4

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ