public inbox for netdev@vger.kernel.org
 help / color / mirror / Atom feed
From: Simon Horman <horms@kernel.org>
To: konradybcio@kernel.org
Cc: Simon Horman <horms@kernel.org>,
	pabeni@redhat.com, marijn.suijten@somainline.org,
	edumazet@google.com, elder@riscstar.com, andrew+netdev@lunn.ch,
	dmitry.baryshkov@oss.qualcomm.com,
	konrad.dybcio@oss.qualcomm.com, andersson@kernel.org,
	elder@kernel.org, devicetree@vger.kernel.org, krzk@kernel.org,
	linux-arm-msm@vger.kernel.org, davem@davemloft.net,
	kuba@kernel.org, conor+dt@kernel.org, netdev@vger.kernel.org,
	linux-kernel@vger.kernel.org, robh@kernel.org,
	krzk+dt@kernel.org
Subject: Re: [net-next,v3,3/3] net: ipa: Grab IMEM slice base/size from DTS
Date: Wed, 18 Feb 2026 10:39:19 +0000	[thread overview]
Message-ID: <20260218103917.132153-3-horms@kernel.org> (raw)
In-Reply-To: <20260217-topic-ipa_imem-v3-3-d6d8ed1dfb67@oss.qualcomm.com>

This is an AI-generated review of your patch. The human sending this
email has considered the AI review valid, or at least plausible.

For local reproduction steps see https://netdev-ai.bots.linux.dev/ai-local.html
---
net: ipa: Grab IMEM slice base/size from DTS

This commit reads the IMEM slice base address and size from a device
tree "sram" phandle, falling back to the existing struct fields when
the DT property is absent.

> diff --git a/drivers/net/ipa/ipa_mem.c b/drivers/net/ipa/ipa_mem.c
> index 835a3c9c1fd4..583aea625709 100644
> --- a/drivers/net/ipa/ipa_mem.c
> +++ b/drivers/net/ipa/ipa_mem.c

[ ... ]

> @@ -656,7 +659,23 @@ int ipa_mem_init(struct ipa *ipa, struct platform_device *pdev,
>  	ipa->mem_addr = res->start;
>  	ipa->mem_size = resource_size(res);
>
> -	ret = ipa_imem_init(ipa, mem_data->imem_addr, mem_data->imem_size);
> +	ipa_slice_np = of_parse_phandle(dev->of_node, "sram", 0);
> +	if (ipa_slice_np) {
> +		ret = of_address_to_resource(ipa_slice_np, 0, res);

Here, res still points into the platform device's resource array from
the earlier platform_get_resource_byname() call.  Won't
of_address_to_resource() overwrite the platform device's "ipa-shared"
resource entry with the SRAM resource data?

The needed values (mem_addr, mem_size) were already copied out, but
this silently corrupts the platform device's resource table.  Would it
be better to use a local struct resource for this call?

Simon says: I think this is a false positive as I don't see how reusing res
here results in resource table corruption.

> +		of_node_put(ipa_slice_np);
> +		if (ret)
> +			return ret;
                        ^^^^^^^^^^

At this point ipa->mem_virt holds a valid memremap() pointer.  Does
this direct return leak the mapping?  Every other error path after the
memremap() in this function uses goto err_unmap, which calls
memunmap(ipa->mem_virt).  Should this be goto err_unmap instead?

Simon says: This seems to me to be an actual problem.

> +
> +		imem_base = res->start;
> +		imem_size = resource_size(res);

[ ... ]

> +	ret = ipa_imem_init(ipa, imem_base, imem_size);
>  	if (ret)
>  		goto err_unmap;

  parent reply	other threads:[~2026-02-18 10:41 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-02-17 13:30 [net-next PATCH v3 0/3] Grab IPA IMEM slice through DT Konrad Dybcio
2026-02-17 13:30 ` [PATCH net-next v3 1/3] dt-bindings: sram: qcom,imem: Allow modem-tables subnode Konrad Dybcio
2026-02-17 18:01   ` Alex Elder
2026-02-17 20:25   ` Krzysztof Kozlowski
2026-02-18 11:05     ` Konrad Dybcio
2026-02-18 11:56       ` Krzysztof Kozlowski
2026-02-18 12:26         ` Konrad Dybcio
2026-02-18 13:21           ` Krzysztof Kozlowski
2026-02-18 13:32             ` Konrad Dybcio
2026-02-19 11:01               ` Krzysztof Kozlowski
2026-02-19 11:01   ` Krzysztof Kozlowski
2026-02-17 13:30 ` [PATCH net-next v3 2/3] dt-bindings: net: qcom,ipa: Add sram property for describing IMEM slice Konrad Dybcio
2026-02-17 13:30 ` [PATCH net-next v3 3/3] net: ipa: Grab IMEM slice base/size from DTS Konrad Dybcio
2026-02-17 18:01   ` Alex Elder
2026-02-18 10:39   ` Simon Horman [this message]
2026-02-18 11:21     ` [net-next,v3,3/3] " Konrad Dybcio

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20260218103917.132153-3-horms@kernel.org \
    --to=horms@kernel.org \
    --cc=andersson@kernel.org \
    --cc=andrew+netdev@lunn.ch \
    --cc=conor+dt@kernel.org \
    --cc=davem@davemloft.net \
    --cc=devicetree@vger.kernel.org \
    --cc=dmitry.baryshkov@oss.qualcomm.com \
    --cc=edumazet@google.com \
    --cc=elder@kernel.org \
    --cc=elder@riscstar.com \
    --cc=konrad.dybcio@oss.qualcomm.com \
    --cc=konradybcio@kernel.org \
    --cc=krzk+dt@kernel.org \
    --cc=krzk@kernel.org \
    --cc=kuba@kernel.org \
    --cc=linux-arm-msm@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=marijn.suijten@somainline.org \
    --cc=netdev@vger.kernel.org \
    --cc=pabeni@redhat.com \
    --cc=robh@kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox