diff mbox series

[v2] net: socket: suppress unused warning

Message ID 20230310221851.304657-1-vincenzopalazzodev@gmail.com (mailing list archive)
State Accepted
Commit ad4bf5f2406f6a2e29266bbad74e18f0d955ac4c
Delegated to: Netdev Maintainers
Headers show
Series [v2] net: socket: suppress unused warning | expand

Checks

Context Check Description
netdev/series_format warning Single patches do not need cover letters; Target tree name not specified in the subject
netdev/tree_selection success Guessed tree name to be net-next
netdev/fixes_present success Fixes tag not required for -next series
netdev/header_inline success No static functions without inline keyword in header files
netdev/build_32bit success Errors and warnings before: 20 this patch: 20
netdev/cc_maintainers success CCed 5 of 5 maintainers
netdev/build_clang success Errors and warnings before: 18 this patch: 18
netdev/verify_signedoff success Signed-off-by tag matches author and committer
netdev/deprecated_api success None detected
netdev/check_selftest success No net selftest shell script
netdev/verify_fixes success No Fixes tag
netdev/build_allmodconfig_warn success Errors and warnings before: 20 this patch: 20
netdev/checkpatch success total: 0 errors, 0 warnings, 0 checks, 10 lines checked
netdev/kdoc success Errors and warnings before: 0 this patch: 0
netdev/source_inline success Was 0 now: 0

Commit Message

Vincenzo Palazzo March 10, 2023, 10:18 p.m. UTC
suppress unused warnings and fix the error that there is
with the W=1 enabled.

Warning generated

net/socket.c: In function ‘__sys_getsockopt’:
net/socket.c:2300:13: error: variable ‘max_optlen’ set but not used [-Werror=unused-but-set-variable]
 2300 |         int max_optlen;

Signed-off-by: Vincenzo Palazzo <vincenzopalazzodev@gmail.com>
---
 net/socket.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Kuniyuki Iwashima March 12, 2023, 3:31 a.m. UTC | #1
From:   Vincenzo Palazzo <vincenzopalazzodev@gmail.com>
Date:   Fri, 10 Mar 2023 23:18:51 +0100
> suppress unused warnings and fix the error that there is
> with the W=1 enabled.
> 
> Warning generated
> 
> net/socket.c: In function ‘__sys_getsockopt’:
> net/socket.c:2300:13: error: variable ‘max_optlen’ set but not used [-Werror=unused-but-set-variable]
>  2300 |         int max_optlen;
> 
> Signed-off-by: Vincenzo Palazzo <vincenzopalazzodev@gmail.com>

Reviewed-by: Kuniyuki Iwashima <kuniyu@amazon.com>

Thanks,
Kuniyuki


> ---
>  net/socket.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/net/socket.c b/net/socket.c
> index 6bae8ce7059e..ad081c9b429f 100644
> --- a/net/socket.c
> +++ b/net/socket.c
> @@ -2295,9 +2295,9 @@ INDIRECT_CALLABLE_DECLARE(bool tcp_bpf_bypass_getsockopt(int level,
>  int __sys_getsockopt(int fd, int level, int optname, char __user *optval,
>  		int __user *optlen)
>  {
> +	int max_optlen __maybe_unused;
>  	int err, fput_needed;
>  	struct socket *sock;
> -	int max_optlen;
>  
>  	sock = sockfd_lookup_light(fd, &err, &fput_needed);
>  	if (!sock)
> -- 
> 2.39.2
patchwork-bot+netdevbpf@kernel.org March 13, 2023, 11:10 p.m. UTC | #2
Hello:

This patch was applied to netdev/net-next.git (main)
by Jakub Kicinski <kuba@kernel.org>:

On Fri, 10 Mar 2023 23:18:51 +0100 you wrote:
> suppress unused warnings and fix the error that there is
> with the W=1 enabled.
> 
> Warning generated
> 
> net/socket.c: In function ‘__sys_getsockopt’:
> net/socket.c:2300:13: error: variable ‘max_optlen’ set but not used [-Werror=unused-but-set-variable]
>  2300 |         int max_optlen;
> 
> [...]

Here is the summary with links:
  - [v2] net: socket: suppress unused warning
    https://git.kernel.org/netdev/net-next/c/ad4bf5f2406f

You are awesome, thank you!
diff mbox series

Patch

diff --git a/net/socket.c b/net/socket.c
index 6bae8ce7059e..ad081c9b429f 100644
--- a/net/socket.c
+++ b/net/socket.c
@@ -2295,9 +2295,9 @@  INDIRECT_CALLABLE_DECLARE(bool tcp_bpf_bypass_getsockopt(int level,
 int __sys_getsockopt(int fd, int level, int optname, char __user *optval,
 		int __user *optlen)
 {
+	int max_optlen __maybe_unused;
 	int err, fput_needed;
 	struct socket *sock;
-	int max_optlen;
 
 	sock = sockfd_lookup_light(fd, &err, &fput_needed);
 	if (!sock)