From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-lf0-x22d.google.com (mail-lf0-x22d.google.com [IPv6:2a00:1450:4010:c07::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 EEC3B21EB88FC for ; Fri, 1 Sep 2017 06:01:42 -0700 (PDT) Received: by mail-lf0-x22d.google.com with SMTP id d17so659224lfe.1 for ; Fri, 01 Sep 2017 06:04:27 -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=AVwrV0b8BHxDGYjWxDhFH0idBwzD0dNq/TITHmV9FFU=; b=rwF5USf4uwjkoepjjEKzim1Lpyb8NyETkUKsLqzKqr3w+TbWBpLvwMb00/d+t787BG Nx8/vsbVOKft0AlwmxLaXrrxNnpuEGUGReLHCt8jg2VY1fpeDbng45dx6tUXodRSgBpJ NcEMrFQktpFY5CmrHKkogoGt9GLUz4G1iBVDdtm+7OMni0mpnMIYyr3WOIsnaHQkswqL 1WS6+i52tNjRJmz/hebqKGlgwQ5cEvt77j6XMwuP3QFQuxyAD2xz7jma/6U3ZU820gsl JBTdAg9Y92yVmfYtUPD5W+fpjeaU9f79Rq0lYx62uY2OzPtaz4FSSEoCJMZ++wuixqBh Ljwg== 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=AVwrV0b8BHxDGYjWxDhFH0idBwzD0dNq/TITHmV9FFU=; b=QbLa+kSyzVbla70KGsx8nVv50qIsnw8sdV8S1Jr+sitnb3sjy3nAVAvN/6W+DAd+X4 xBQjUU1xS+B1gAJ6oi6kC2bnZuCGx4Ye9YGv8RXrp+pRUDw689QFC9Xw3/WfaQGN4XAy zlrJggaNljv1UpigNz778J5HwcApt6yyE+ejscdAhD64ZWUqh+wDcP8Fo2cgYD45wJ7l Hr5MSbt+cR+C6csC9Zhmn9OX4Nw0AIsipnilvMg88WNMaNgqej60yuwsVtB6QILi+tXI Zb6+dvYq222o8juOkVkVPkrRacumNw+5247yQpMZwRI5aP7kG0GJApw8zdSFWI5DAJqr Un4g== X-Gm-Message-State: AHPjjUidnG92eV1n+OT2LDdVlgE0BIU+fCIqhsxHAKHmmcGYrzUa9o6h CSV+i51sJv4DoU1k1hi6Kg== X-Google-Smtp-Source: ADKCNb62p0Zh35Xx+846efgJx5B7qYoPKA9QTW7JaDHvg9Gp3La0B3BRF9y0516w/wFjyaJVjzXtHg== X-Received: by 10.25.190.84 with SMTP id o81mr964760lff.228.1504271065554; Fri, 01 Sep 2017 06:04:25 -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 m129sm21754lfg.26.2017.09.01.06.04.24 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 01 Sep 2017 06:04:24 -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: Fri, 1 Sep 2017 15:08:15 +0200 Message-Id: <1504271303-1782-4-git-send-email-mw@semihalf.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1504271303-1782-1-git-send-email-mw@semihalf.com> References: <1504271303-1782-1-git-send-email-mw@semihalf.com> Subject: [platforms: PATCH 03/11] Drivers/Spi/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: Fri, 01 Sep 2017 13:01:43 -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 --- 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 0872f61..6ddfcf6 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