From 367497486d637ff07518872ad21f2cf2d8443e80 Mon Sep 17 00:00:00 2001 From: Jacob Garber Date: Tue, 2 Jul 2019 11:08:53 -0600 Subject: sb/intel/common: Use correct bitwise operator MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Like the line above it, this should be & instead of | (otherwise it will always incorrectly return true). spi_locked() is only used internally to decide which opcodes will be used to talk to the flash, and if it is falsely reported as locked, the worst case should be a denial of service (unless there are more bugs). Change-Id: I5208b523c815d15d7263594f06ccfacd8a9510b1 Signed-off-by: Jacob Garber Found-by: Coverity CID 1402092 Reviewed-on: https://review.coreboot.org/c/coreboot/+/33963 Tested-by: build bot (Jenkins) Reviewed-by: HAOUAS Elyes Reviewed-by: Kyösti Mälkki Reviewed-by: Paul Menzel Reviewed-by: Nico Huber --- src/southbridge/intel/common/spi.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/southbridge/intel/common/spi.c b/src/southbridge/intel/common/spi.c index e8c8f01407..e9e66dcda3 100644 --- a/src/southbridge/intel/common/spi.c +++ b/src/southbridge/intel/common/spi.c @@ -338,7 +338,7 @@ static int spi_locked(void) if (CONFIG(SOUTHBRIDGE_INTEL_I82801GX)) { return !!(readw_(&cntlr->ich7_spi->spis) & HSFS_FLOCKDN); } else { - return !!(readw_(&cntlr->ich9_spi->hsfs) | HSFS_FLOCKDN); + return !!(readw_(&cntlr->ich9_spi->hsfs) & HSFS_FLOCKDN); } } -- cgit v1.2.3