All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] selftests/ipc: Fix msgque compiler warnings
@ 2019-04-08 17:13 ` keescook
  0 siblings, 0 replies; 9+ messages in thread
From: Kees Cook @ 2019-04-08 17:13 UTC (permalink / raw)
  To: Shuah Khan
  Cc: Stanislav Kinsbursky, Manfred Spraul, Davidlohr Bueso,
	linux-kselftest, linux-kernel

This fixes the various compiler warnings when building the msgque
selftest. The primary change is using sys/msg.h instead of linux/msg.h
directly to gain the API declarations.

Fixes: 3a665531a3b7 ("selftests: IPC message queue copy feature test")
Signed-off-by: Kees Cook <keescook@chromium.org>
---
 tools/testing/selftests/ipc/msgque.c | 11 ++++++-----
 1 file changed, 6 insertions(+), 5 deletions(-)

diff --git a/tools/testing/selftests/ipc/msgque.c b/tools/testing/selftests/ipc/msgque.c
index dac927e82336..4c156aeab6b8 100644
--- a/tools/testing/selftests/ipc/msgque.c
+++ b/tools/testing/selftests/ipc/msgque.c
@@ -1,9 +1,10 @@
 // SPDX-License-Identifier: GPL-2.0
+#define _GNU_SOURCE
 #include <stdlib.h>
 #include <stdio.h>
 #include <string.h>
 #include <errno.h>
-#include <linux/msg.h>
+#include <sys/msg.h>
 #include <fcntl.h>
 
 #include "../kselftest.h"
@@ -73,7 +74,7 @@ int restore_queue(struct msgque_data *msgque)
 	return 0;
 
 destroy:
-	if (msgctl(id, IPC_RMID, 0))
+	if (msgctl(id, IPC_RMID, NULL))
 		printf("Failed to destroy queue: %d\n", -errno);
 	return ret;
 }
@@ -120,7 +121,7 @@ int check_and_destroy_queue(struct msgque_data *msgque)
 
 	ret = 0;
 err:
-	if (msgctl(msgque->msq_id, IPC_RMID, 0)) {
+	if (msgctl(msgque->msq_id, IPC_RMID, NULL)) {
 		printf("Failed to destroy queue: %d\n", -errno);
 		return -errno;
 	}
@@ -129,7 +130,7 @@ int check_and_destroy_queue(struct msgque_data *msgque)
 
 int dump_queue(struct msgque_data *msgque)
 {
-	struct msqid64_ds ds;
+	struct msqid_ds ds;
 	int kern_id;
 	int i, ret;
 
@@ -245,7 +246,7 @@ int main(int argc, char **argv)
 	return ksft_exit_pass();
 
 err_destroy:
-	if (msgctl(msgque.msq_id, IPC_RMID, 0)) {
+	if (msgctl(msgque.msq_id, IPC_RMID, NULL)) {
 		printf("Failed to destroy queue: %d\n", -errno);
 		return ksft_exit_fail();
 	}
-- 
2.17.1


-- 
Kees Cook

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

* [PATCH] selftests/ipc: Fix msgque compiler warnings
@ 2019-04-08 17:13 ` keescook
  0 siblings, 0 replies; 9+ messages in thread
From: keescook @ 2019-04-08 17:13 UTC (permalink / raw)


This fixes the various compiler warnings when building the msgque
selftest. The primary change is using sys/msg.h instead of linux/msg.h
directly to gain the API declarations.

Fixes: 3a665531a3b7 ("selftests: IPC message queue copy feature test")
Signed-off-by: Kees Cook <keescook at chromium.org>
---
 tools/testing/selftests/ipc/msgque.c | 11 ++++++-----
 1 file changed, 6 insertions(+), 5 deletions(-)

diff --git a/tools/testing/selftests/ipc/msgque.c b/tools/testing/selftests/ipc/msgque.c
index dac927e82336..4c156aeab6b8 100644
--- a/tools/testing/selftests/ipc/msgque.c
+++ b/tools/testing/selftests/ipc/msgque.c
@@ -1,9 +1,10 @@
 // SPDX-License-Identifier: GPL-2.0
+#define _GNU_SOURCE
 #include <stdlib.h>
 #include <stdio.h>
 #include <string.h>
 #include <errno.h>
-#include <linux/msg.h>
+#include <sys/msg.h>
 #include <fcntl.h>
 
 #include "../kselftest.h"
@@ -73,7 +74,7 @@ int restore_queue(struct msgque_data *msgque)
 	return 0;
 
 destroy:
-	if (msgctl(id, IPC_RMID, 0))
+	if (msgctl(id, IPC_RMID, NULL))
 		printf("Failed to destroy queue: %d\n", -errno);
 	return ret;
 }
@@ -120,7 +121,7 @@ int check_and_destroy_queue(struct msgque_data *msgque)
 
 	ret = 0;
 err:
-	if (msgctl(msgque->msq_id, IPC_RMID, 0)) {
+	if (msgctl(msgque->msq_id, IPC_RMID, NULL)) {
 		printf("Failed to destroy queue: %d\n", -errno);
 		return -errno;
 	}
@@ -129,7 +130,7 @@ int check_and_destroy_queue(struct msgque_data *msgque)
 
 int dump_queue(struct msgque_data *msgque)
 {
-	struct msqid64_ds ds;
+	struct msqid_ds ds;
 	int kern_id;
 	int i, ret;
 
@@ -245,7 +246,7 @@ int main(int argc, char **argv)
 	return ksft_exit_pass();
 
 err_destroy:
-	if (msgctl(msgque.msq_id, IPC_RMID, 0)) {
+	if (msgctl(msgque.msq_id, IPC_RMID, NULL)) {
 		printf("Failed to destroy queue: %d\n", -errno);
 		return ksft_exit_fail();
 	}
-- 
2.17.1


-- 
Kees Cook

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

* [PATCH] selftests/ipc: Fix msgque compiler warnings
@ 2019-04-08 17:13 ` keescook
  0 siblings, 0 replies; 9+ messages in thread
From: Kees Cook @ 2019-04-08 17:13 UTC (permalink / raw)


This fixes the various compiler warnings when building the msgque
selftest. The primary change is using sys/msg.h instead of linux/msg.h
directly to gain the API declarations.

Fixes: 3a665531a3b7 ("selftests: IPC message queue copy feature test")
Signed-off-by: Kees Cook <keescook at chromium.org>
---
 tools/testing/selftests/ipc/msgque.c | 11 ++++++-----
 1 file changed, 6 insertions(+), 5 deletions(-)

diff --git a/tools/testing/selftests/ipc/msgque.c b/tools/testing/selftests/ipc/msgque.c
index dac927e82336..4c156aeab6b8 100644
--- a/tools/testing/selftests/ipc/msgque.c
+++ b/tools/testing/selftests/ipc/msgque.c
@@ -1,9 +1,10 @@
 // SPDX-License-Identifier: GPL-2.0
+#define _GNU_SOURCE
 #include <stdlib.h>
 #include <stdio.h>
 #include <string.h>
 #include <errno.h>
-#include <linux/msg.h>
+#include <sys/msg.h>
 #include <fcntl.h>
 
 #include "../kselftest.h"
@@ -73,7 +74,7 @@ int restore_queue(struct msgque_data *msgque)
 	return 0;
 
 destroy:
-	if (msgctl(id, IPC_RMID, 0))
+	if (msgctl(id, IPC_RMID, NULL))
 		printf("Failed to destroy queue: %d\n", -errno);
 	return ret;
 }
@@ -120,7 +121,7 @@ int check_and_destroy_queue(struct msgque_data *msgque)
 
 	ret = 0;
 err:
-	if (msgctl(msgque->msq_id, IPC_RMID, 0)) {
+	if (msgctl(msgque->msq_id, IPC_RMID, NULL)) {
 		printf("Failed to destroy queue: %d\n", -errno);
 		return -errno;
 	}
@@ -129,7 +130,7 @@ int check_and_destroy_queue(struct msgque_data *msgque)
 
 int dump_queue(struct msgque_data *msgque)
 {
-	struct msqid64_ds ds;
+	struct msqid_ds ds;
 	int kern_id;
 	int i, ret;
 
@@ -245,7 +246,7 @@ int main(int argc, char **argv)
 	return ksft_exit_pass();
 
 err_destroy:
-	if (msgctl(msgque.msq_id, IPC_RMID, 0)) {
+	if (msgctl(msgque.msq_id, IPC_RMID, NULL)) {
 		printf("Failed to destroy queue: %d\n", -errno);
 		return ksft_exit_fail();
 	}
-- 
2.17.1


-- 
Kees Cook

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

* Re: [PATCH] selftests/ipc: Fix msgque compiler warnings
  2019-04-08 17:13 ` keescook
  (?)
@ 2019-04-08 20:01   ` dave
  -1 siblings, 0 replies; 9+ messages in thread
From: Davidlohr Bueso @ 2019-04-08 20:01 UTC (permalink / raw)
  To: Kees Cook
  Cc: Shuah Khan, Stanislav Kinsbursky, Manfred Spraul,
	linux-kselftest, linux-kernel

On Mon, 08 Apr 2019, Kees Cook wrote:

>This fixes the various compiler warnings when building the msgque
>selftest. The primary change is using sys/msg.h instead of linux/msg.h
>directly to gain the API declarations.
>
>Fixes: 3a665531a3b7 ("selftests: IPC message queue copy feature test")
>Signed-off-by: Kees Cook <keescook@chromium.org>

(Not really related to this patch)

Given that the selftest/ipc/ only consists of this test, I wonder if
the test should just be moved to ltp, where the ipc tests are a lot
more complete and robust -- and which I've been using for years for
basic testing code changes.

Don't get me wrong, I'm all for having ipc tests in the kernel, but it
seems rather impractical to have them in both places considering the
relevance of ltp in the community and how long they have existed there.

I'm also speaking on the basis that by ipc we are referring only to
sysv and posix flavors.

Thanks,
Davidlohr

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

* [PATCH] selftests/ipc: Fix msgque compiler warnings
@ 2019-04-08 20:01   ` dave
  0 siblings, 0 replies; 9+ messages in thread
From: dave @ 2019-04-08 20:01 UTC (permalink / raw)


On Mon, 08 Apr 2019, Kees Cook wrote:

>This fixes the various compiler warnings when building the msgque
>selftest. The primary change is using sys/msg.h instead of linux/msg.h
>directly to gain the API declarations.
>
>Fixes: 3a665531a3b7 ("selftests: IPC message queue copy feature test")
>Signed-off-by: Kees Cook <keescook at chromium.org>

(Not really related to this patch)

Given that the selftest/ipc/ only consists of this test, I wonder if
the test should just be moved to ltp, where the ipc tests are a lot
more complete and robust -- and which I've been using for years for
basic testing code changes.

Don't get me wrong, I'm all for having ipc tests in the kernel, but it
seems rather impractical to have them in both places considering the
relevance of ltp in the community and how long they have existed there.

I'm also speaking on the basis that by ipc we are referring only to
sysv and posix flavors.

Thanks,
Davidlohr

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

* [PATCH] selftests/ipc: Fix msgque compiler warnings
@ 2019-04-08 20:01   ` dave
  0 siblings, 0 replies; 9+ messages in thread
From: Davidlohr Bueso @ 2019-04-08 20:01 UTC (permalink / raw)


On Mon, 08 Apr 2019, Kees Cook wrote:

>This fixes the various compiler warnings when building the msgque
>selftest. The primary change is using sys/msg.h instead of linux/msg.h
>directly to gain the API declarations.
>
>Fixes: 3a665531a3b7 ("selftests: IPC message queue copy feature test")
>Signed-off-by: Kees Cook <keescook at chromium.org>

(Not really related to this patch)

Given that the selftest/ipc/ only consists of this test, I wonder if
the test should just be moved to ltp, where the ipc tests are a lot
more complete and robust -- and which I've been using for years for
basic testing code changes.

Don't get me wrong, I'm all for having ipc tests in the kernel, but it
seems rather impractical to have them in both places considering the
relevance of ltp in the community and how long they have existed there.

I'm also speaking on the basis that by ipc we are referring only to
sysv and posix flavors.

Thanks,
Davidlohr

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

* Re: [PATCH] selftests/ipc: Fix msgque compiler warnings
  2019-04-08 20:01   ` dave
  (?)
@ 2019-04-19 19:10     ` shuah
  -1 siblings, 0 replies; 9+ messages in thread
From: shuah @ 2019-04-19 19:10 UTC (permalink / raw)
  To: Davidlohr Bueso, Kees Cook
  Cc: Stanislav Kinsbursky, Manfred Spraul, linux-kselftest,
	linux-kernel, shuah

On 4/8/19 2:01 PM, Davidlohr Bueso wrote:
> On Mon, 08 Apr 2019, Kees Cook wrote:
> 
>> This fixes the various compiler warnings when building the msgque
>> selftest. The primary change is using sys/msg.h instead of linux/msg.h
>> directly to gain the API declarations.
>>
>> Fixes: 3a665531a3b7 ("selftests: IPC message queue copy feature test")
>> Signed-off-by: Kees Cook <keescook@chromium.org>
> 
> (Not really related to this patch)
> 
> Given that the selftest/ipc/ only consists of this test, I wonder if
> the test should just be moved to ltp, where the ipc tests are a lot
> more complete and robust -- and which I've been using for years for
> basic testing code changes.
> 

Having this test in here helps us find regressions quickly. It does good
and no harm keeping this test in here.

I don't think it is a good idea to remove it all together.

thanks,
-- Shuah


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

* [PATCH] selftests/ipc: Fix msgque compiler warnings
@ 2019-04-19 19:10     ` shuah
  0 siblings, 0 replies; 9+ messages in thread
From: shuah @ 2019-04-19 19:10 UTC (permalink / raw)


On 4/8/19 2:01 PM, Davidlohr Bueso wrote:
> On Mon, 08 Apr 2019, Kees Cook wrote:
> 
>> This fixes the various compiler warnings when building the msgque
>> selftest. The primary change is using sys/msg.h instead of linux/msg.h
>> directly to gain the API declarations.
>>
>> Fixes: 3a665531a3b7 ("selftests: IPC message queue copy feature test")
>> Signed-off-by: Kees Cook <keescook at chromium.org>
> 
> (Not really related to this patch)
> 
> Given that the selftest/ipc/ only consists of this test, I wonder if
> the test should just be moved to ltp, where the ipc tests are a lot
> more complete and robust -- and which I've been using for years for
> basic testing code changes.
> 

Having this test in here helps us find regressions quickly. It does good
and no harm keeping this test in here.

I don't think it is a good idea to remove it all together.

thanks,
-- Shuah

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

* [PATCH] selftests/ipc: Fix msgque compiler warnings
@ 2019-04-19 19:10     ` shuah
  0 siblings, 0 replies; 9+ messages in thread
From: shuah @ 2019-04-19 19:10 UTC (permalink / raw)


On 4/8/19 2:01 PM, Davidlohr Bueso wrote:
> On Mon, 08 Apr 2019, Kees Cook wrote:
> 
>> This fixes the various compiler warnings when building the msgque
>> selftest. The primary change is using sys/msg.h instead of linux/msg.h
>> directly to gain the API declarations.
>>
>> Fixes: 3a665531a3b7 ("selftests: IPC message queue copy feature test")
>> Signed-off-by: Kees Cook <keescook at chromium.org>
> 
> (Not really related to this patch)
> 
> Given that the selftest/ipc/ only consists of this test, I wonder if
> the test should just be moved to ltp, where the ipc tests are a lot
> more complete and robust -- and which I've been using for years for
> basic testing code changes.
> 

Having this test in here helps us find regressions quickly. It does good
and no harm keeping this test in here.

I don't think it is a good idea to remove it all together.

thanks,
-- Shuah

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

end of thread, other threads:[~2019-04-19 19:10 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-04-08 17:13 [PATCH] selftests/ipc: Fix msgque compiler warnings Kees Cook
2019-04-08 17:13 ` Kees Cook
2019-04-08 17:13 ` keescook
2019-04-08 20:01 ` Davidlohr Bueso
2019-04-08 20:01   ` Davidlohr Bueso
2019-04-08 20:01   ` dave
2019-04-19 19:10   ` shuah
2019-04-19 19:10     ` shuah
2019-04-19 19:10     ` shuah

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.