From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received-SPF: None (no SPF record) identity=mailfrom; client-ip=2a00:1450:400c:c0c::22d; helo=mail-wr0-x22d.google.com; envelope-from=mw@semihalf.com; receiver=edk2-devel@lists.01.org Received: from mail-wr0-x22d.google.com (mail-wr0-x22d.google.com [IPv6:2a00:1450:400c:c0c::22d]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by ml01.01.org (Postfix) with ESMTPS id 875A420945B97 for ; Sun, 24 Sep 2017 18:42:55 -0700 (PDT) Received: by mail-wr0-x22d.google.com with SMTP id m18so5213552wrm.2 for ; Sun, 24 Sep 2017 18:46:06 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=semihalf-com.20150623.gappssmtp.com; s=20150623; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=0MAN6YwS410x5Uda5bJHvW5m5TU3HXk+AGpdMd6Fhkw=; b=zhF1jkYUPmsrNnQhj7GtHHBesqHavj9324IC9FBD51p76H1OZDU+1RCu7MtaFIhJxV kp4rLTYvURlDJHN0VgAmZhHvAIrgnk3LDLZB2aG6XEYgzFTfxYL+LtsbIQK0qRJgRPpN 5Gnwd3BwPKtDbCZrysmCeeNI1saV4LgVQCSiLXt9JPklkjt3gsqG6W/22sCDD2YoOLdm QCORoJNEP2EmuLdFadSqhRDmuJZJqngppXV8EWOf4pVdgA1zz7s6w3oGAim5aLMekq3o A/bTdNoQYop7670LDu0K03Iym5aIZ4On02mXSQUwz1MmdssqcAKOL8yTONb1aPo1jPRf CUBA== 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:in-reply-to :references; bh=0MAN6YwS410x5Uda5bJHvW5m5TU3HXk+AGpdMd6Fhkw=; b=E/fD18d93ItoNY2fPTX+qVpDILjyqYCAehoZA8Rr4PMFJN9cs6xKfzfWwPRUHrTkDK 3wBpPBJrkTiWBAup9YrjiAFZCqPVs+jSa+oB+MDR9RbT3MQqDhN68DgDNLCdXc4fP+Pw 3Z3rxM42FJRT5MlD1CG6+ECMtecCTXvNOUu3GxEn7yEI7WMXg3WhUtS8pyqMBPlqoT9R znL9267GuVh20oeSzMUBf/TFg+DgUanPC/VlfqKXCgzgcLByI8qBR9agUEFthFdP79U+ sZQLd3PlIYJLLSQaEopd877lTXnaq3+G7nUFZXE3JcSbI7QTegQcNrRabEOry5Nh5v+n ZoZw== X-Gm-Message-State: AHPjjUjoEi+2F5oYkcDPlCfIsVOGD8aHszQ4S3aEpDH92u059BM/X0db w1G6kTSYcwoHBftNWslOqDAnakwm9R8= X-Google-Smtp-Source: AOwi7QBYenrMY6O4ppM076esXWJUUZM/ingvEAKdZubodEjxLOpeh6Quf5v3QwoE09XBKwl0iWRu/Q== X-Received: by 10.25.129.196 with SMTP id c187mr1727821lfd.107.1506303964736; Sun, 24 Sep 2017 18:46:04 -0700 (PDT) Received: from enkidu.local (31-172-191-173.noc.fibertech.net.pl. [31.172.191.173]) by smtp.gmail.com with ESMTPSA id f16sm809520lfe.66.2017.09.24.18.46.03 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sun, 24 Sep 2017 18:46:04 -0700 (PDT) From: Marcin Wojtas To: edk2-devel@lists.01.org Cc: leif.lindholm@linaro.org, ard.biesheuvel@linaro.org, nadavh@marvell.com, neta@marvell.com, kostap@marvell.com, jinghua@marvell.com, agraf@suse.de, mw@semihalf.com, jsd@semihalf.com, Joe Zhou Date: Mon, 25 Sep 2017 03:51:52 +0200 Message-Id: <1506304319-8620-4-git-send-email-mw@semihalf.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1506304319-8620-1-git-send-email-mw@semihalf.com> References: <1506304319-8620-1-git-send-email-mw@semihalf.com> Subject: [platforms: PATCH 03/10] Marvell/Drivers: MvSpiDxe: Fix write bug X-BeenThere: edk2-devel@lists.01.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: EDK II Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 25 Sep 2017 01:42:55 -0000 From: Joe Zhou This patch prevents possible NULL pointer dereference during SPI transfers. Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Joe Zhou Signed-off-by: Marcin Wojtas Reviewed-by: Leif Lindholm --- Platform/Marvell/Drivers/Spi/MvSpiDxe.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/Platform/Marvell/Drivers/Spi/MvSpiDxe.c b/Platform/Marvell/Drivers/Spi/MvSpiDxe.c index 0c6b624..29e1379 100755 --- a/Platform/Marvell/Drivers/Spi/MvSpiDxe.c +++ b/Platform/Marvell/Drivers/Spi/MvSpiDxe.c @@ -226,9 +226,8 @@ MvSpiTransfer ( // Wait for memory ready for (Iterator = 0; Iterator < SPI_TIMEOUT; Iterator++) { if (MmioRead32 (SpiRegBase + SPI_INT_CAUSE_REG)) { - *DataInPtr = MmioRead32 (SpiRegBase + SPI_DATA_IN_REG); - if (DataInPtr != NULL) { + *DataInPtr = MmioRead32 (SpiRegBase + SPI_DATA_IN_REG); DataInPtr++; } if (DataOutPtr != NULL) { -- 1.8.3.1