* [PATCH][next] net: tcp: Remove redundant initialization of variable len
@ 2024-02-16 12:54 Colin Ian King
2024-02-16 13:00 ` Eric Dumazet
2024-02-20 10:50 ` patchwork-bot+netdevbpf
0 siblings, 2 replies; 4+ messages in thread
From: Colin Ian King @ 2024-02-16 12:54 UTC (permalink / raw)
To: Eric Dumazet, David S . Miller, David Ahern, Jakub Kicinski,
Paolo Abeni, netdev
Cc: kernel-janitors, linux-kernel
The variable len being initialized with a value that is never read, an
if statement is initializing it in both paths of the if statement.
The initialization is redundant and can be removed.
Cleans up clang scan build warning:
net/ipv4/tcp_ao.c:512:11: warning: Value stored to 'len' during its
initialization is never read [deadcode.DeadStores]
Signed-off-by: Colin Ian King <colin.i.king@gmail.com>
---
net/ipv4/tcp_ao.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/net/ipv4/tcp_ao.c b/net/ipv4/tcp_ao.c
index 87db432c6bb4..3afeeb68e8a7 100644
--- a/net/ipv4/tcp_ao.c
+++ b/net/ipv4/tcp_ao.c
@@ -509,9 +509,9 @@ static int tcp_ao_hash_header(struct tcp_sigpool *hp,
bool exclude_options, u8 *hash,
int hash_offset, int hash_len)
{
- int err, len = th->doff << 2;
struct scatterlist sg;
u8 *hdr = hp->scratch;
+ int err, len;
/* We are not allowed to change tcphdr, make a local copy */
if (exclude_options) {
--
2.39.2
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH][next] net: tcp: Remove redundant initialization of variable len
2024-02-16 12:54 [PATCH][next] net: tcp: Remove redundant initialization of variable len Colin Ian King
@ 2024-02-16 13:00 ` Eric Dumazet
2024-02-16 15:30 ` Dmitry Safonov
2024-02-20 10:50 ` patchwork-bot+netdevbpf
1 sibling, 1 reply; 4+ messages in thread
From: Eric Dumazet @ 2024-02-16 13:00 UTC (permalink / raw)
To: Colin Ian King, Dmitry Safonov
Cc: David S . Miller, David Ahern, Jakub Kicinski, Paolo Abeni,
netdev, kernel-janitors, linux-kernel
On Fri, Feb 16, 2024 at 1:54 PM Colin Ian King <colin.i.king@gmail.com> wrote:
>
> The variable len being initialized with a value that is never read, an
> if statement is initializing it in both paths of the if statement.
> The initialization is redundant and can be removed.
>
> Cleans up clang scan build warning:
> net/ipv4/tcp_ao.c:512:11: warning: Value stored to 'len' during its
> initialization is never read [deadcode.DeadStores]
>
> Signed-off-by: Colin Ian King <colin.i.king@gmail.com>
> ---
> net/ipv4/tcp_ao.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/net/ipv4/tcp_ao.c b/net/ipv4/tcp_ao.c
> index 87db432c6bb4..3afeeb68e8a7 100644
> --- a/net/ipv4/tcp_ao.c
> +++ b/net/ipv4/tcp_ao.c
> @@ -509,9 +509,9 @@ static int tcp_ao_hash_header(struct tcp_sigpool *hp,
> bool exclude_options, u8 *hash,
> int hash_offset, int hash_len)
> {
> - int err, len = th->doff << 2;
> struct scatterlist sg;
> u8 *hdr = hp->scratch;
> + int err, len;
>
> /* We are not allowed to change tcphdr, make a local copy */
> if (exclude_options) {
> --
> 2.39.2
>
Cc Dmitry Safonov
Dmitry, can you take a look ?
Thanks !
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH][next] net: tcp: Remove redundant initialization of variable len
2024-02-16 13:00 ` Eric Dumazet
@ 2024-02-16 15:30 ` Dmitry Safonov
0 siblings, 0 replies; 4+ messages in thread
From: Dmitry Safonov @ 2024-02-16 15:30 UTC (permalink / raw)
To: Colin Ian King
Cc: David S . Miller, David Ahern, Jakub Kicinski, Paolo Abeni,
netdev, kernel-janitors, linux-kernel, Eric Dumazet
On 2/16/24 13:00, Eric Dumazet wrote:
> On Fri, Feb 16, 2024 at 1:54 PM Colin Ian King <colin.i.king@gmail.com> wrote:
>>
>> The variable len being initialized with a value that is never read, an
>> if statement is initializing it in both paths of the if statement.
>> The initialization is redundant and can be removed.
>>
>> Cleans up clang scan build warning:
>> net/ipv4/tcp_ao.c:512:11: warning: Value stored to 'len' during its
>> initialization is never read [deadcode.DeadStores]
>>
>> Signed-off-by: Colin Ian King <colin.i.king@gmail.com>
LGTM,
Reviewed-by: Dmitry Safonov <0x7f454c46@gmail.com>
>> ---
>> net/ipv4/tcp_ao.c | 2 +-
>> 1 file changed, 1 insertion(+), 1 deletion(-)
>>
>> diff --git a/net/ipv4/tcp_ao.c b/net/ipv4/tcp_ao.c
>> index 87db432c6bb4..3afeeb68e8a7 100644
>> --- a/net/ipv4/tcp_ao.c
>> +++ b/net/ipv4/tcp_ao.c
>> @@ -509,9 +509,9 @@ static int tcp_ao_hash_header(struct tcp_sigpool *hp,
>> bool exclude_options, u8 *hash,
>> int hash_offset, int hash_len)
>> {
>> - int err, len = th->doff << 2;
>> struct scatterlist sg;
>> u8 *hdr = hp->scratch;
>> + int err, len;
>>
>> /* We are not allowed to change tcphdr, make a local copy */
>> if (exclude_options) {
>> --
>> 2.39.2
>>
>
> Cc Dmitry Safonov
>
> Dmitry, can you take a look ?
Thanks for Cc'ing!
>
> Thanks !
Thanks,
Dmitry
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH][next] net: tcp: Remove redundant initialization of variable len
2024-02-16 12:54 [PATCH][next] net: tcp: Remove redundant initialization of variable len Colin Ian King
2024-02-16 13:00 ` Eric Dumazet
@ 2024-02-20 10:50 ` patchwork-bot+netdevbpf
1 sibling, 0 replies; 4+ messages in thread
From: patchwork-bot+netdevbpf @ 2024-02-20 10:50 UTC (permalink / raw)
To: Colin Ian King
Cc: edumazet, davem, dsahern, kuba, pabeni, netdev, kernel-janitors,
linux-kernel
Hello:
This patch was applied to netdev/net-next.git (main)
by Paolo Abeni <pabeni@redhat.com>:
On Fri, 16 Feb 2024 12:54:43 +0000 you wrote:
> The variable len being initialized with a value that is never read, an
> if statement is initializing it in both paths of the if statement.
> The initialization is redundant and can be removed.
>
> Cleans up clang scan build warning:
> net/ipv4/tcp_ao.c:512:11: warning: Value stored to 'len' during its
> initialization is never read [deadcode.DeadStores]
>
> [...]
Here is the summary with links:
- [next] net: tcp: Remove redundant initialization of variable len
https://git.kernel.org/netdev/net-next/c/465c1abcb644
You are awesome, thank you!
--
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2024-02-20 10:50 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-02-16 12:54 [PATCH][next] net: tcp: Remove redundant initialization of variable len Colin Ian King
2024-02-16 13:00 ` Eric Dumazet
2024-02-16 15:30 ` Dmitry Safonov
2024-02-20 10:50 ` patchwork-bot+netdevbpf
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®