diff options
| author | Chuck Lever <[email protected]> | 2024-05-07 09:10:41 -0400 | 
|---|---|---|
| committer | Chuck Lever <[email protected]> | 2024-05-09 09:10:10 -0400 | 
| commit | bafa6b4d95d97877baa61883ff90f7e374427fae (patch) | |
| tree | 9a0e51bf5e1d0a70e2bc45ae3a50e5bee8885dac /rust/kernel/init.rs | |
| parent | 939cb14d51a150e3c12ef7a8ce0ba04ce6131bd2 (diff) | |
SUNRPC: Fix gss_free_in_token_pages()
Dan Carpenter says:
> Commit 5866efa8cbfb ("SUNRPC: Fix svcauth_gss_proxy_init()") from Oct
> 24, 2019 (linux-next), leads to the following Smatch static checker
> warning:
>
> 	net/sunrpc/auth_gss/svcauth_gss.c:1039 gss_free_in_token_pages()
> 	warn: iterator 'i' not incremented
>
> net/sunrpc/auth_gss/svcauth_gss.c
>     1034 static void gss_free_in_token_pages(struct gssp_in_token *in_token)
>     1035 {
>     1036         u32 inlen;
>     1037         int i;
>     1038
> --> 1039         i = 0;
>     1040         inlen = in_token->page_len;
>     1041         while (inlen) {
>     1042                 if (in_token->pages[i])
>     1043                         put_page(in_token->pages[i]);
>                                                          ^
> This puts page zero over and over.
>
>     1044                 inlen -= inlen > PAGE_SIZE ? PAGE_SIZE : inlen;
>     1045         }
>     1046
>     1047         kfree(in_token->pages);
>     1048         in_token->pages = NULL;
>     1049 }
Based on the way that the ->pages[] array is constructed in
gss_read_proxy_verf(), we know that once the loop encounters a NULL
page pointer, the remaining array elements must also be NULL.
Reported-by: Dan Carpenter <[email protected]>
Suggested-by: Trond Myklebust <[email protected]>
Fixes: 5866efa8cbfb ("SUNRPC: Fix svcauth_gss_proxy_init()")
Signed-off-by: Chuck Lever <[email protected]>
Diffstat (limited to 'rust/kernel/init.rs')
0 files changed, 0 insertions, 0 deletions