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 6F779199FBA; Mon, 23 Jun 2025 22:20:39 +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=1750717239; cv=none; b=JpOhrz+TPIFNfS61uVY3kyU8E6b92xDqWvvSVIglZowYNNkAOrfsH1zNKC7W9aoneBQE+VdznMub+daIO7nBZCvLhkbBVsr5ngIJR4S5os4TkPD6fg/DnbJYeKsi+AoHIcUMJe+h9sXhFqlP2fHzT3E+7rqt0GXsqBhvvbdKc5Y= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1750717239; c=relaxed/simple; bh=aze5XG6hZRpSwVHiixqU/W6c63BVjrG9FAV4Mqg1amM=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=n8nSZJrhOpyqbT+GeTynd3RgO7UvZBb3F/Yg0kPTCDoIkgJlGtd0C01e3UL5U8050BH9oOodY/cQKfOhQ3MEJ4lBSHx4rHPrGIqEjU9m3zsbPqk8H5sXyeIOdSAsplBl18efL4TTlTwrmFimR0Ofk6FqcR3edS7DT0kWlGtJWf4= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=13fgesIR; 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="13fgesIR" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 94179C4CEEA; Mon, 23 Jun 2025 22:20:38 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1750717238; bh=aze5XG6hZRpSwVHiixqU/W6c63BVjrG9FAV4Mqg1amM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=13fgesIRWnF0mL9FW8F26ydrjhJfg0BpR47sGuIVu+UYO2uRVsLfrUdPAAi/6Zl24 lAIAkIaTKciYSMvEhtH36O9rptQhqswhFug2DsfVBTvTjazHWbY+5xPRuTWPVN8n09 uZplv58vKSjGiVyCpAoBkzD7y8NXZBgzrZGukVog= From: Greg Kroah-Hartman To: stable@vger.kernel.org Cc: Greg Kroah-Hartman , patches@lists.linux.dev, Sergio Perez Gonzalez , Claudiu Beznea , Jakub Kicinski , Sasha Levin Subject: [PATCH 6.1 387/508] net: macb: Check return value of dma_set_mask_and_coherent() Date: Mon, 23 Jun 2025 15:07:12 +0200 Message-ID: <20250623130654.808712237@linuxfoundation.org> X-Mailer: git-send-email 2.50.0 In-Reply-To: <20250623130645.255320792@linuxfoundation.org> References: <20250623130645.255320792@linuxfoundation.org> User-Agent: quilt/0.68 X-stable: review X-Patchwork-Hint: ignore Precedence: bulk X-Mailing-List: stable@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 6.1-stable review patch. If anyone has any objections, please let me know. ------------------ From: Sergio Perez Gonzalez [ Upstream commit 3920a758800762917177a6b5ab39707d8e376fe6 ] Issue flagged by coverity. Add a safety check for the return value of dma_set_mask_and_coherent, go to a safe exit if it returns error. Link: https://scan7.scan.coverity.com/#/project-view/53936/11354?selectedIssue=1643754 Signed-off-by: Sergio Perez Gonzalez Reviewed-by: Claudiu Beznea Link: https://patch.msgid.link/20250526032034.84900-1-sperezglz@gmail.com Signed-off-by: Jakub Kicinski Signed-off-by: Sasha Levin --- drivers/net/ethernet/cadence/macb_main.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/drivers/net/ethernet/cadence/macb_main.c b/drivers/net/ethernet/cadence/macb_main.c index d2f4709dee0de..495a1cb0bc183 100644 --- a/drivers/net/ethernet/cadence/macb_main.c +++ b/drivers/net/ethernet/cadence/macb_main.c @@ -4956,7 +4956,11 @@ static int macb_probe(struct platform_device *pdev) #ifdef CONFIG_ARCH_DMA_ADDR_T_64BIT if (GEM_BFEXT(DAW64, gem_readl(bp, DCFG6))) { - dma_set_mask_and_coherent(&pdev->dev, DMA_BIT_MASK(44)); + err = dma_set_mask_and_coherent(&pdev->dev, DMA_BIT_MASK(44)); + if (err) { + dev_err(&pdev->dev, "failed to set DMA mask\n"); + goto err_out_free_netdev; + } bp->hw_dma_cap |= HW_DMA_CAP_64B; } #endif -- 2.39.5