diff mbox series

[v2,15/22] net/eth: Clean up local variable shadowing

Message ID 20230904161235.84651-16-philmd@linaro.org
State Superseded
Headers show
Series (few more) Steps towards enabling -Wshadow | expand

Commit Message

Philippe Mathieu-Daudé Sept. 4, 2023, 4:12 p.m. UTC
Fix:

  net/eth.c:435:20: error: declaration shadows a local variable [-Werror,-Wshadow]
            size_t input_size = iov_size(pkt, pkt_frags);
                   ^
  net/eth.c:413:16: note: previous declaration is here
        size_t input_size = iov_size(pkt, pkt_frags);
               ^

Suggested-by: Akihiko Odaki <akihiko.odaki@daynix.com>
Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
---
 net/eth.c | 2 --
 1 file changed, 2 deletions(-)

Comments

Eric Blake Sept. 8, 2023, 1:18 p.m. UTC | #1
On Mon, Sep 04, 2023 at 06:12:27PM +0200, Philippe Mathieu-Daudé wrote:
> Fix:
> 
>   net/eth.c:435:20: error: declaration shadows a local variable [-Werror,-Wshadow]
>             size_t input_size = iov_size(pkt, pkt_frags);
>                    ^
>   net/eth.c:413:16: note: previous declaration is here
>         size_t input_size = iov_size(pkt, pkt_frags);
>                ^
> 
> Suggested-by: Akihiko Odaki <akihiko.odaki@daynix.com>
> Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
> ---
>  net/eth.c | 2 --
>  1 file changed, 2 deletions(-)

Reviewed-by: Eric Blake <eblake@redhat.com>
Akihiko Odaki Sept. 10, 2023, 4:20 a.m. UTC | #2
On 2023/09/05 1:12, Philippe Mathieu-Daudé wrote:
> Fix:
> 
>    net/eth.c:435:20: error: declaration shadows a local variable [-Werror,-Wshadow]
>              size_t input_size = iov_size(pkt, pkt_frags);
>                     ^
>    net/eth.c:413:16: note: previous declaration is here
>          size_t input_size = iov_size(pkt, pkt_frags);
>                 ^
> 
> Suggested-by: Akihiko Odaki <akihiko.odaki@daynix.com>
> Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
> ---
>   net/eth.c | 2 --
>   1 file changed, 2 deletions(-)
> 
> diff --git a/net/eth.c b/net/eth.c
> index 649e66bb1f..3f680cc033 100644
> --- a/net/eth.c
> +++ b/net/eth.c
> @@ -432,8 +432,6 @@ _eth_get_rss_ex_src_addr(const struct iovec *pkt, int pkt_frags,
>           }
>   
>           if (opthdr.type == IP6_OPT_HOME) {
> -            size_t input_size = iov_size(pkt, pkt_frags);
> -
>               if (input_size < opt_offset + sizeof(opthdr)) {
>                   return false;
>               }

Reviewed-by: Akihiko Odaki <akihiko.odaki@daynix.com>
diff mbox series

Patch

diff --git a/net/eth.c b/net/eth.c
index 649e66bb1f..3f680cc033 100644
--- a/net/eth.c
+++ b/net/eth.c
@@ -432,8 +432,6 @@  _eth_get_rss_ex_src_addr(const struct iovec *pkt, int pkt_frags,
         }
 
         if (opthdr.type == IP6_OPT_HOME) {
-            size_t input_size = iov_size(pkt, pkt_frags);
-
             if (input_size < opt_offset + sizeof(opthdr)) {
                 return false;
             }