public inbox for netdev@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] net: qrtr: fix handling of confirm_rx field
@ 2026-03-20 13:28 Alexander Wilhelm
  2026-03-21 10:19 ` Simon Horman
  0 siblings, 1 reply; 5+ messages in thread
From: Alexander Wilhelm @ 2026-03-20 13:28 UTC (permalink / raw)
  To: Manivannan Sadhasivam, Bjorn Andersson, David S. Miller,
	Eric Dumazet, Jakub Kicinski, Paolo Abeni, Simon Horman
  Cc: linux-arm-msm, netdev, linux-kernel

Convert confirm_rx to little endian when enqueueing by using cpu_to_le32(),
as big endian systems otherwise interpret the value incorrectly.

When receiving, apply le32_to_cpu(). !! ensures the result becomes 0 or 1
in native CPU endianness, so this conversion is not strictly required, but
it is kept for consistency, clarity, and future safety.

Fixes: 5fdeb0d372ab ("net: qrtr: Implement outgoing flow control")
Signed-off-by: Alexander Wilhelm <alexander.wilhelm@westermo.com>
---
 net/qrtr/af_qrtr.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/net/qrtr/af_qrtr.c b/net/qrtr/af_qrtr.c
index 55fd2dd37588..bea1f1720e7f 100644
--- a/net/qrtr/af_qrtr.c
+++ b/net/qrtr/af_qrtr.c
@@ -365,7 +365,7 @@ static int qrtr_node_enqueue(struct qrtr_node *node, struct sk_buff *skb,
 	}
 
 	hdr->size = cpu_to_le32(len);
-	hdr->confirm_rx = !!confirm_rx;
+	hdr->confirm_rx = cpu_to_le32(!!confirm_rx);
 
 	rc = skb_put_padto(skb, ALIGN(len, 4) + sizeof(*hdr));
 
@@ -466,7 +466,7 @@ int qrtr_endpoint_post(struct qrtr_endpoint *ep, const void *data, size_t len)
 		cb->type = le32_to_cpu(v1->type);
 		cb->src_node = le32_to_cpu(v1->src_node_id);
 		cb->src_port = le32_to_cpu(v1->src_port_id);
-		cb->confirm_rx = !!v1->confirm_rx;
+		cb->confirm_rx = !!le32_to_cpu(v1->confirm_rx);
 		cb->dst_node = le32_to_cpu(v1->dst_node_id);
 		cb->dst_port = le32_to_cpu(v1->dst_port_id);
 

---
base-commit: 0e4f8f1a3d081e834be5fd0a62bdb2554fadd307
change-id: 20260320-qrtr-fix-confirm_rx-on-big-endian-09a2c0e9af5d

Best regards,
-- 
Alexander Wilhelm <alexander.wilhelm@westermo.com>


^ permalink raw reply related	[flat|nested] 5+ messages in thread

* Re: [PATCH] net: qrtr: fix handling of confirm_rx field
  2026-03-20 13:28 [PATCH] net: qrtr: fix handling of confirm_rx field Alexander Wilhelm
@ 2026-03-21 10:19 ` Simon Horman
  2026-03-23  6:51   ` Alexander Wilhelm
  0 siblings, 1 reply; 5+ messages in thread
From: Simon Horman @ 2026-03-21 10:19 UTC (permalink / raw)
  To: Alexander Wilhelm
  Cc: Manivannan Sadhasivam, Bjorn Andersson, David S. Miller,
	Eric Dumazet, Jakub Kicinski, Paolo Abeni, linux-arm-msm, netdev,
	linux-kernel

On Fri, Mar 20, 2026 at 02:28:52PM +0100, Alexander Wilhelm wrote:
> Convert confirm_rx to little endian when enqueueing by using cpu_to_le32(),
> as big endian systems otherwise interpret the value incorrectly.
> 
> When receiving, apply le32_to_cpu(). !! ensures the result becomes 0 or 1
> in native CPU endianness, so this conversion is not strictly required, but
> it is kept for consistency, clarity, and future safety.

Hi Alexander,

It seems to me that the conversion is required if the code
runs on a Big Endian host. What is your thinking on this?

> 
> Fixes: 5fdeb0d372ab ("net: qrtr: Implement outgoing flow control")
> Signed-off-by: Alexander Wilhelm <alexander.wilhelm@westermo.com>

...

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] net: qrtr: fix handling of confirm_rx field
  2026-03-21 10:19 ` Simon Horman
@ 2026-03-23  6:51   ` Alexander Wilhelm
  2026-03-23 15:32     ` Simon Horman
  0 siblings, 1 reply; 5+ messages in thread
From: Alexander Wilhelm @ 2026-03-23  6:51 UTC (permalink / raw)
  To: Simon Horman
  Cc: Manivannan Sadhasivam, Bjorn Andersson, David S. Miller,
	Eric Dumazet, Jakub Kicinski, Paolo Abeni, linux-arm-msm, netdev,
	linux-kernel

On Sat, Mar 21, 2026 at 10:19:26AM +0000, Simon Horman wrote:
> On Fri, Mar 20, 2026 at 02:28:52PM +0100, Alexander Wilhelm wrote:
> > Convert confirm_rx to little endian when enqueueing by using cpu_to_le32(),
> > as big endian systems otherwise interpret the value incorrectly.
> > 
> > When receiving, apply le32_to_cpu(). !! ensures the result becomes 0 or 1
> > in native CPU endianness, so this conversion is not strictly required, but
> > it is kept for consistency, clarity, and future safety.
> 
> Hi Alexander,
> 
> It seems to me that the conversion is required if the code
> runs on a Big Endian host. What is your thinking on this?

Hi Simon,

Yes, that is correct. The patch fixes the control flow on Big Endian platforms
only. It has no impact on Little Endian systems.


Best regards
Alexander Wilhelm

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] net: qrtr: fix handling of confirm_rx field
  2026-03-23  6:51   ` Alexander Wilhelm
@ 2026-03-23 15:32     ` Simon Horman
  2026-03-24  7:05       ` Alexander Wilhelm
  0 siblings, 1 reply; 5+ messages in thread
From: Simon Horman @ 2026-03-23 15:32 UTC (permalink / raw)
  To: Alexander Wilhelm
  Cc: Manivannan Sadhasivam, Bjorn Andersson, David S. Miller,
	Eric Dumazet, Jakub Kicinski, Paolo Abeni, linux-arm-msm, netdev,
	linux-kernel

On Mon, Mar 23, 2026 at 07:51:08AM +0100, Alexander Wilhelm wrote:
> On Sat, Mar 21, 2026 at 10:19:26AM +0000, Simon Horman wrote:
> > On Fri, Mar 20, 2026 at 02:28:52PM +0100, Alexander Wilhelm wrote:
> > > Convert confirm_rx to little endian when enqueueing by using cpu_to_le32(),
> > > as big endian systems otherwise interpret the value incorrectly.
> > > 
> > > When receiving, apply le32_to_cpu(). !! ensures the result becomes 0 or 1
> > > in native CPU endianness, so this conversion is not strictly required, but
> > > it is kept for consistency, clarity, and future safety.
> > 
> > Hi Alexander,
> > 
> > It seems to me that the conversion is required if the code
> > runs on a Big Endian host. What is your thinking on this?
> 
> Hi Simon,
> 
> Yes, that is correct. The patch fixes the control flow on Big Endian platforms
> only. It has no impact on Little Endian systems.

Thanks Alexander,

Please send a v2 with the commit message updated accordingly.

As this is a fix, please base the patch on the net tree.
And target that tree like this:

Subject: [PATCH v2 net] net: qrtr: fix handling of confirm_rx field

Or perhaps, making the subject slightly more descriptive:

Subject: [PATCH v2 net] net: qrtr: fix endian handling of confirm_rx field

-- 
pw-bot: changes-requested

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] net: qrtr: fix handling of confirm_rx field
  2026-03-23 15:32     ` Simon Horman
@ 2026-03-24  7:05       ` Alexander Wilhelm
  0 siblings, 0 replies; 5+ messages in thread
From: Alexander Wilhelm @ 2026-03-24  7:05 UTC (permalink / raw)
  To: Simon Horman
  Cc: Manivannan Sadhasivam, Bjorn Andersson, David S. Miller,
	Eric Dumazet, Jakub Kicinski, Paolo Abeni, linux-arm-msm, netdev,
	linux-kernel

On Mon, Mar 23, 2026 at 03:32:54PM +0000, Simon Horman wrote:
> On Mon, Mar 23, 2026 at 07:51:08AM +0100, Alexander Wilhelm wrote:
> > On Sat, Mar 21, 2026 at 10:19:26AM +0000, Simon Horman wrote:
> > > On Fri, Mar 20, 2026 at 02:28:52PM +0100, Alexander Wilhelm wrote:
> > > > Convert confirm_rx to little endian when enqueueing by using cpu_to_le32(),
> > > > as big endian systems otherwise interpret the value incorrectly.
> > > > 
> > > > When receiving, apply le32_to_cpu(). !! ensures the result becomes 0 or 1
> > > > in native CPU endianness, so this conversion is not strictly required, but
> > > > it is kept for consistency, clarity, and future safety.
> > > 
> > > Hi Alexander,
> > > 
> > > It seems to me that the conversion is required if the code
> > > runs on a Big Endian host. What is your thinking on this?
> > 
> > Hi Simon,
> > 
> > Yes, that is correct. The patch fixes the control flow on Big Endian platforms
> > only. It has no impact on Little Endian systems.
> 
> Thanks Alexander,
> 
> Please send a v2 with the commit message updated accordingly.
> 
> As this is a fix, please base the patch on the net tree.
> And target that tree like this:
> 
> Subject: [PATCH v2 net] net: qrtr: fix handling of confirm_rx field
> 
> Or perhaps, making the subject slightly more descriptive:
> 
> Subject: [PATCH v2 net] net: qrtr: fix endian handling of confirm_rx field

Sure, I will improve the commit description in version 2.


Best regards
Alexander Wilhelm

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2026-03-24  7:05 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-03-20 13:28 [PATCH] net: qrtr: fix handling of confirm_rx field Alexander Wilhelm
2026-03-21 10:19 ` Simon Horman
2026-03-23  6:51   ` Alexander Wilhelm
2026-03-23 15:32     ` Simon Horman
2026-03-24  7:05       ` Alexander Wilhelm

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox