[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20251105231212.1491817-1-nate.karstens@garmin.com>
Date: Wed, 5 Nov 2025 17:12:12 -0600
From: Nate Karstens <nate.karstens@...min.com>
To: <jacob.e.keller@...el.com>
CC: <davem@...emloft.net>, <edumazet@...gle.com>, <horms@...nel.org>,
<john.fastabend@...il.com>, <kuba@...nel.org>,
<linux-kernel@...r.kernel.org>, <linux@...blig.org>, <mrpre@....com>,
<nate.karstens@...min.com>, <nate.karstens@...il.com>,
<netdev@...r.kernel.org>, <pabeni@...hat.com>,
<stable@...r.kernel.org>, <tom@...ntonium.net>
Subject: Re: [PATCH] strparser: Fix signed/unsigned mismatch bug
Thanks, Jake!
> So, without the ssize_t, I guess everything switches back to unsigned
> here when subtracting skb->len..
That's right. In C, if there is a mix of signed an unsigned, then signed are converted to unsigned and unsigned arithmetic is used.
> I don't quite recall the signed vs unsigned rules for this. Is
> stm.strp.offset also unsigned? which means that after head->len -
> skb->len resolves to unsigned 0 then we underflow?
Here is a summary of the types for the variables involved:
len => ssize_t (signed)
(ssize_t)head->len => unsigned int cast to ssize_t
skb->len => unsigned int, causes the whole comparison to use unsigned arithmetic
stm->strp.offset => int (see struct strp_msg)
> If we don't actually use the strparser code anywhere then it could be
> dropped
It is still used elsewhere, and ktls still uses some of the data structures.
Cheers,
Nate
________________________________
CONFIDENTIALITY NOTICE: This email and any attachments are for the sole use of the intended recipient(s) and contain information that may be Garmin confidential and/or Garmin legally privileged. If you have received this email in error, please notify the sender by reply email and delete the message. Any disclosure, copying, distribution or use of this communication (including attachments) by someone other than the intended recipient is prohibited. Thank you.
________________________________
CONFIDENTIALITY NOTICE: This email and any attachments are for the sole use of the intended recipient(s) and contain information that may be Garmin confidential and/or Garmin legally privileged. If you have received this email in error, please notify the sender by reply email and delete the message. Any disclosure, copying, distribution or use of this communication (including attachments) by someone other than the intended recipient is prohibited. Thank you.
Powered by blists - more mailing lists