From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-alma10-1.taild15c8.ts.net [100.103.45.18]) (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 AE8903D9036; Thu, 21 May 2026 17:31:01 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=100.103.45.18 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1779384662; cv=none; b=nAp4ImNR41GarK2aMU0rN3xdxJAJkVaY/J4LymHQwzlkG1fIbhLRouddKHfpGD2NUPqaqbW1qziwqHKZqVF0+4Ux4Sv9Ug6PNkuuJUkmrmrL6kJYVaVuuj+VqA/mGrpHabOS1CBDd2PCaL3OOXdxNHb0uE0t9QrzamW/WvgfqOA= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1779384662; c=relaxed/simple; bh=9XJdbfgv4z9kk1tnll5YqOQVu2RhWQi9Uybxyermr78=; h=From:Subject:To:Cc:In-Reply-To:References:Content-Type:Date: Message-Id; b=RkqV12WfpieWndm7tux27I5lAG/ggwJBoRIBRH+83RHrrlryHwCbuaqadz+cE5TYOFRZFqljm6bT/c/mTJyPv3+bWHrPql3wajiDMpppcT8aG9+2tV2fe6H8NX56VkW/+Ksu1AYhJVGOqAFDs4YfZrxjVJpzKvwSPemZ7oFh9UI= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=k7v2z8ZR; arc=none smtp.client-ip=100.103.45.18 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="k7v2z8ZR" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 0A7131F000E9; Thu, 21 May 2026 17:31:01 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org; s=k20260515; t=1779384661; bh=8njoPscqTq937OjwscNew/6YWYe+q4Hky/XitnHgDjw=; h=From:Subject:Reply-To:To:Cc:In-Reply-To:References:Date; b=k7v2z8ZRmoeQ7KtOjeJ55ogR0hqmrxP9Q7Hd/l0Mdfz7asL+6KeXcC+w37tgQAmmQ ql146zABwqAqsNx5hTB02yul/BS7YQBdoyNp/PO4U5VfVZ8fzl/BjhZO7O862SmiJd hiRVb5SKKh7eFahRL5zhpSyunmvckgNsHiEheeq9P90wHOzF0foWKsww8dxoNa6of5 JNGDIKodtTJ/mgbFEu7d2Q+BvBizdbuMYvtB1J+0djv72dHgbCj10/PFZU9f62Mrxx awQHh8isG7KV9T4gufh40gr8K0w6xFgvfNb7YjbrX1eNlRUQhOhaLI0FYb+pgnftK3 /V1FW544/QA1Q== From: sashiko-bot@kernel.org Subject: Re: [PATCH v7 3/9] PCI: endpoint: pci-epf-test: Use dmaenigne_prep_config_single() to simplify code Reply-To: sashiko-reviews@lists.linux.dev To: Frank.Li@oss.nxp.com Cc: linux-pci@vger.kernel.org, Frank.Li@kernel.org, dmaengine@vger.kernel.org, imx@lists.linux.dev, vkoul@kernel.org In-Reply-To: <20260521-dma_prep_config-v7-3-1f73f4899883@nxp.com> References: <20260521-dma_prep_config-v7-3-1f73f4899883@nxp.com> Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Date: Thu, 21 May 2026 17:31:00 +0000 Message-Id: <20260521173101.0A7131F000E9@smtp.kernel.org> Precedence: bulk X-Mailing-List: linux-pci@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: Thank you for your contribution! Sashiko AI review found 1 potential issue(= s) to consider: Pre-existing issues: - [High] Unvalidated `size` from PCIe test registers leads to arbitrarily l= arge `kzalloc` allocations, potentially triggering kernel warnings or panic= s. -- commit a2e73aaa3ad55ca4f65ceeb2cf567d9f9ac1f014 Author: Frank Li PCI: endpoint: pci-epf-test: Use dmaenigne_prep_config_single() to simplify= code This commit simplifies the DMA configuration code by replacing dmaengine_slave_config() and dmaengine_prep_slave_single() with a single call to dmaengine_prep_config_single(). > diff --git a/drivers/pci/endpoint/functions/pci-epf-test.c b/drivers/pci/= endpoint/functions/pci-epf-test.c > --- a/drivers/pci/endpoint/functions/pci-epf-test.c > +++ b/drivers/pci/endpoint/functions/pci-epf-test.c > @@ -182,12 +182,8 @@ static int pci_epf_test_data_transfer(struct pci_epf= _test *epf_test, > else > sconf.src_addr =3D dma_remote; > =20 > - if (dmaengine_slave_config(chan, &sconf)) { > - dev_err(dev, "DMA slave config fail\n"); > - return -EIO; > - } > - tx =3D dmaengine_prep_slave_single(chan, dma_local, len, dir, > - flags); > + tx =3D dmaengine_prep_config_single(chan, dma_local, len, > + dir, flags, &sconf); [Severity: High] This is a pre-existing issue, but I noticed a potential problem with how the len parameter is handled by the callers of this transfer code. The functions pci_epf_test_copy(), pci_epf_test_read(), and pci_epf_test_write() read a 32-bit size value directly from the memory-mapp= ed reg->size register, which is controlled by an external PCIe host. This raw size is then passed directly to kzalloc() without any bounds check= ing or validation. Could this allow a malicious or misconfigured PCIe host to pass an arbitrar= ily large size to kzalloc(), triggering a page allocator warning and stack trace that might remotely crash the endpoint kernel if it is configured with panic_on_warn? > } else { > tx =3D dmaengine_prep_dma_memcpy(chan, dma_dst, dma_src, len, > flags); --=20 Sashiko AI review =C2=B7 https://sashiko.dev/#/patchset/20260521-dma_prep_c= onfig-v7-0-1f73f4899883@nxp.com?part=3D3