Re: [PATCH net] rxrpc: Fix untrusted unsigned subtract
From: Simon Horman <horms@kernel.org>
Date: 2025-09-12 18:48:05
Also in:
lkml
On Fri, Sep 12, 2025 at 12:06:17AM +0100, David Howells wrote:
Fix the following Smatch Smatch static checker warning:
nit: Smatch Smatch -> Smatch
net/rxrpc/rxgk_app.c:65 rxgk_yfs_decode_ticket()
warn: untrusted unsigned subtract. 'ticket_len - 10 * 4'
by prechecking the length of what we're trying to extract in two places in
the token and decoding for a response packet.
Also use sizeof() on the struct we're extracting rather specifying the size
numerically to be consistent with the other related statements.
Fixes: 9d1d2b59341f ("rxrpc: rxgk: Implement the yfs-rxgk security class (GSSAPI)")
Reported-by: Dan Carpenter <redacted>
Closes: https://lists.infradead.org/pipermail/linux-afs/2025-September/010135.html
Signed-off-by: David Howells <dhowells@redhat.com>
cc: Marc Dionne <marc.dionne@auristor.com>
cc: Jakub Kicinski <kuba@kernel.org>
cc: "David S. Miller" <davem@davemloft.net>
cc: Eric Dumazet <edumazet@google.com>
cc: Paolo Abeni <pabeni@redhat.com>
cc: Simon Horman <horms@kernel.org>
cc: linux-afs@lists.infradead.org
cc: netdev@vger.kernel.org
---
net/rxrpc/rxgk_app.c | 19 ++++++++++++++-----
1 file changed, 14 insertions(+), 5 deletions(-)Reviewed-by: Simon Horman <horms@kernel.org>