All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH v2 net-next] selftests: net: af_unix: Fix a build error of unix_connect.c.
@ 2022-07-20  0:57 Kuniyuki Iwashima
  2022-07-21  4:10 ` patchwork-bot+netdevbpf
  0 siblings, 1 reply; 2+ messages in thread
From: Kuniyuki Iwashima @ 2022-07-20  0:57 UTC (permalink / raw)
  To: David S. Miller, Eric Dumazet, Jakub Kicinski, Paolo Abeni
  Cc: Kuniyuki Iwashima, Kuniyuki Iwashima, netdev, kernel test robot

This patch fixes a build error reported in the link. [0]

  unix_connect.c: In function ‘unix_connect_test’:
  unix_connect.c:115:55: error: expected identifier before ‘(’ token
   #define offsetof(type, member) ((size_t)&((type *)0)->(member))
                                                       ^
  unix_connect.c:128:12: note: in expansion of macro ‘offsetof’
    addrlen = offsetof(struct sockaddr_un, sun_path) + variant->len;
              ^~~~~~~~

We can fix this by removing () around member, but checkpatch will complain
about it, and the root cause of the build failure is that I followed the
warning and fixed this in the v2 -> v3 change of the blamed commit. [1]

  CHECK: Macro argument 'member' may be better as '(member)' to avoid precedence issues
  #33: FILE: tools/testing/selftests/net/af_unix/unix_connect.c:115:
  +#define offsetof(type, member) ((size_t)&((type *)0)->member)

To avoid this warning, let's use offsetof() defined in stddef.h instead.

[0]: https://lore.kernel.org/linux-mm/202207182205.FrkMeDZT-lkp@intel.com/
[1]: https://lore.kernel.org/netdev/20220702154818.66761-1-kuniyu@amazon.com/

Fixes: e95ab1d85289 ("selftests: net: af_unix: Test connect() with different netns.")
Reported-by: kernel test robot <lkp@intel.com>
Suggested-by: Jakub Kicinski <kuba@kernel.org>
Signed-off-by: Kuniyuki Iwashima <kuniyu@amazon.com>
---
v2:
  * Use offsetof() in stddef.h instead of defining it. (Jakub Kicinski)

v1: https://lore.kernel.org/netdev/20220718162350.19186-1-kuniyu@amazon.com/
---
 tools/testing/selftests/net/af_unix/unix_connect.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/tools/testing/selftests/net/af_unix/unix_connect.c b/tools/testing/selftests/net/af_unix/unix_connect.c
index 157e44ef7f37..d799fd8f5c7c 100644
--- a/tools/testing/selftests/net/af_unix/unix_connect.c
+++ b/tools/testing/selftests/net/af_unix/unix_connect.c
@@ -3,6 +3,7 @@
 #define _GNU_SOURCE
 #include <sched.h>
 
+#include <stddef.h>
 #include <stdio.h>
 #include <unistd.h>
 
@@ -112,8 +113,6 @@ FIXTURE_TEARDOWN(unix_connect)
 		remove("test");
 }
 
-#define offsetof(type, member) ((size_t)&((type *)0)->(member))
-
 TEST_F(unix_connect, test)
 {
 	socklen_t addrlen;
-- 
2.30.2


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH v2 net-next] selftests: net: af_unix: Fix a build error of unix_connect.c.
  2022-07-20  0:57 [PATCH v2 net-next] selftests: net: af_unix: Fix a build error of unix_connect.c Kuniyuki Iwashima
@ 2022-07-21  4:10 ` patchwork-bot+netdevbpf
  0 siblings, 0 replies; 2+ messages in thread
From: patchwork-bot+netdevbpf @ 2022-07-21  4:10 UTC (permalink / raw)
  To: Kuniyuki Iwashima; +Cc: davem, edumazet, kuba, pabeni, kuni1840, netdev, lkp

Hello:

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

On Tue, 19 Jul 2022 17:57:50 -0700 you wrote:
> This patch fixes a build error reported in the link. [0]
> 
>   unix_connect.c: In function ‘unix_connect_test’:
>   unix_connect.c:115:55: error: expected identifier before ‘(’ token
>    #define offsetof(type, member) ((size_t)&((type *)0)->(member))
>                                                        ^
>   unix_connect.c:128:12: note: in expansion of macro ‘offsetof’
>     addrlen = offsetof(struct sockaddr_un, sun_path) + variant->len;
>               ^~~~~~~~
> 
> [...]

Here is the summary with links:
  - [v2,net-next] selftests: net: af_unix: Fix a build error of unix_connect.c.
    https://git.kernel.org/netdev/net-next/c/f12b86c0d606

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] 2+ messages in thread

end of thread, other threads:[~2022-07-21  4:10 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-07-20  0:57 [PATCH v2 net-next] selftests: net: af_unix: Fix a build error of unix_connect.c Kuniyuki Iwashima
2022-07-21  4:10 ` patchwork-bot+netdevbpf

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.