Re: [PATCH] rxrpc: fix handling of an unsupported token type in rxrpc_read()

2021-01-06 Thread Tom Rix
On 1/6/21 1:09 PM, David Howells wrote: > Tom Rix wrote: > >> On 1/6/21 11:44 AM, David Howells wrote: >>> Tom Rix wrote: >>> These two loops iterate over the same data, i believe returning here is all that is needed. >>> But if the first loop is made to support a new type, but the

Re: [PATCH] rxrpc: fix handling of an unsupported token type in rxrpc_read()

2021-01-06 Thread David Howells
Tom Rix wrote: > On 1/6/21 11:44 AM, David Howells wrote: > > Tom Rix wrote: > > > >> These two loops iterate over the same data, i believe returning here is all > >> that is needed. > > But if the first loop is made to support a new type, but the second loop is > > missed, it will then likely

Re: [PATCH] rxrpc: fix handling of an unsupported token type in rxrpc_read()

2021-01-06 Thread Tom Rix
On 1/6/21 11:44 AM, David Howells wrote: > Tom Rix wrote: > >> These two loops iterate over the same data, i believe returning here is all >> that is needed. > But if the first loop is made to support a new type, but the second loop is > missed, it will then likely oops. Besides, the compiler

Re: [PATCH] rxrpc: fix handling of an unsupported token type in rxrpc_read()

2021-01-06 Thread David Howells
Tom Rix wrote: > These two loops iterate over the same data, i believe returning here is all > that is needed. But if the first loop is made to support a new type, but the second loop is missed, it will then likely oops. Besides, the compiler should optimise both paths together. David

Re: [PATCH] rxrpc: fix handling of an unsupported token type in rxrpc_read()

2021-01-06 Thread Tom Rix
On 1/6/21 9:40 AM, David Howells wrote: > David Howells wrote: > >> How about this? >> ... >> Fix the second loop so that it doesn't encode the size and type of an >> unsupported token, but rather just ignore it as does the first loop. > Actually, a better way is probably just to error

Re: [PATCH] rxrpc: fix handling of an unsupported token type in rxrpc_read()

2021-01-06 Thread David Howells
David Howells wrote: > How about this? > ... > Fix the second loop so that it doesn't encode the size and type of an > unsupported token, but rather just ignore it as does the first loop. Actually, a better way is probably just to error out in this case. This should only happen if a

Re: [PATCH] rxrpc: fix handling of an unsupported token type in rxrpc_read()

2021-01-06 Thread David Howells
How about this? David --- commit 5d370a9db65a6fae82f09a009430ae40c564b0ef Author: David Howells Date: Wed Jan 6 16:21:40 2021 + rxrpc: Fix handling of an unsupported token type in rxrpc_read() Clang static analysis reports the following: net/rxrpc/key.c:657:11:

Re: [PATCH] rxrpc: fix handling of an unsupported token type in rxrpc_read()

2021-01-04 Thread Tom Rix
On 1/4/21 4:50 AM, David Howells wrote: > t...@redhat.com wrote: > >> -switch (token->security_index) { >> -case RXRPC_SECURITY_RXKAD: >> ... >> -switch (token->security_index) { >> -case RXRPC_SECURITY_RXKAD: > These switches need to be kept.

Re: [PATCH] rxrpc: fix handling of an unsupported token type in rxrpc_read()

2021-01-04 Thread David Howells
t...@redhat.com wrote: > - switch (token->security_index) { > - case RXRPC_SECURITY_RXKAD: > ... > - switch (token->security_index) { > - case RXRPC_SECURITY_RXKAD: These switches need to be kept. There's another security type on the way. See:

[PATCH] rxrpc: fix handling of an unsupported token type in rxrpc_read()

2020-12-29 Thread trix
From: Tom Rix clang static analysis reports this problem net/rxrpc/key.c:657:11: warning: Assigned value is garbage or undefined toksize = toksizes[tok++]; ^ ~~~ rxrpc_read() contains two loops. The first loop calculates the token sizes and