From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 34955313E30; Wed, 3 Dec 2025 15:46:47 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1764776807; cv=none; b=XfHVAufBSnD0nj+r4Wh30H2VuIVjFrKUNJ1wyUfl4NdR7RVIJmn35BaSS7njR6RzYFuGUDvIwvPfRtby/qzQwQdfN8OjMwGN8y2UCtfmNoUOfcKnniIEg2NYI1n7B26KHiaXn7psWSw6yZBQfLqASJALeB4wqQZBGuY9QMuOsZk= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1764776807; c=relaxed/simple; bh=vnQDg0V9Fq8zPN3RZ67ecxXP9NnWQEfc2xuqfF2nqNo=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=gXWtQEBrwCoEeYTXP+k9HbZfSsufWxjt+SBv34xWYMCi1EqQkdCx8TKG1Erq98u98Q17cAzUSiuhxzxihT8SIgLVRLrlvN4BZIjuf8cjRUgzCvtzpvarQyl8xhEu5QwCXXyIA5vWIh2sm18NnVU0y93XL6OQFeN+tSCSe/DGrLI= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=UpEdkOgc; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b="UpEdkOgc" Received: by smtp.kernel.org (Postfix) with ESMTPSA id A2A01C4CEF5; Wed, 3 Dec 2025 15:46:46 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1764776807; bh=vnQDg0V9Fq8zPN3RZ67ecxXP9NnWQEfc2xuqfF2nqNo=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=UpEdkOgcGn2gRhQCd20cJ0O9j14ur4KJ0wC5CdIcg1TdL6wzbFRuAeoTIVS36f8rP Q3pYLaaPtkblwhHYoL1hTVzo1mQFBAhrqsyf75IumC/trMVOjFihFNWEEXpLJ2RboH n2Jz2lO0iEf3UzgV0KNCbuDGMCAWgWIfntt/fO94= From: Greg Kroah-Hartman To: stable@vger.kernel.org Cc: Greg Kroah-Hartman , patches@lists.linux.dev, stable , Miaoqian Lin , Gregory CLEMENT Subject: [PATCH 5.10 276/300] serial: amba-pl011: prefer dma_mapping_error() over explicit address checking Date: Wed, 3 Dec 2025 16:28:00 +0100 Message-ID: <20251203152410.854797540@linuxfoundation.org> X-Mailer: git-send-email 2.52.0 In-Reply-To: <20251203152400.447697997@linuxfoundation.org> References: <20251203152400.447697997@linuxfoundation.org> User-Agent: quilt/0.69 X-stable: review X-Patchwork-Hint: ignore Precedence: bulk X-Mailing-List: patches@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 5.10-stable review patch. If anyone has any objections, please let me know. ------------------ From: Miaoqian Lin commit eb4917f557d43c7a1c805dd73ffcdfddb2aba39a upstream. Check for returned DMA addresses using specialized dma_mapping_error() helper which is generally recommended for this purpose by Documentation/core-api/dma-api.rst: "In some circumstances dma_map_single(), ... will fail to create a mapping. A driver can check for these errors by testing the returned DMA address with dma_mapping_error()." Found via static analysis and this is similar to commit fa0308134d26 ("ALSA: memalloc: prefer dma_mapping_error() over explicit address checking") Fixes: 58ac1b379979 ("ARM: PL011: Fix DMA support") Cc: stable Signed-off-by: Miaoqian Lin Reviewed-by: Gregory CLEMENT Link: https://patch.msgid.link/20251027092053.87937-1-linmq006@gmail.com Signed-off-by: Greg Kroah-Hartman --- drivers/tty/serial/amba-pl011.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) --- a/drivers/tty/serial/amba-pl011.c +++ b/drivers/tty/serial/amba-pl011.c @@ -636,7 +636,7 @@ static int pl011_dma_tx_refill(struct ua dmatx->len = count; dmatx->dma = dma_map_single(dma_dev->dev, dmatx->buf, count, DMA_TO_DEVICE); - if (dmatx->dma == DMA_MAPPING_ERROR) { + if (dma_mapping_error(dma_dev->dev, dmatx->dma)) { uap->dmatx.queued = false; dev_dbg(uap->port.dev, "unable to map TX DMA\n"); return -EBUSY;