Merge "Nullability check for msg module." am: a1ff2e6159 am: 6f42b5a3ae

Original change: https://android-review.googlesource.com/c/platform/bionic/+/2539230

Change-Id: Ibbdf41505063269e7c0da8ae8ce104e1585694ee
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
This commit is contained in:
Treehugger Robot 2023-04-17 19:15:52 +00:00 committed by Automerger Merge Worker
commit 38333734ae
2 changed files with 9 additions and 3 deletions

View file

@ -46,12 +46,12 @@ typedef __kernel_ulong_t msgqnum_t;
typedef __kernel_ulong_t msglen_t;
/** Not useful on Android; disallowed by SELinux. */
int msgctl(int __msg_id, int __cmd, struct msqid_ds* __buf) __INTRODUCED_IN(26);
int msgctl(int __msg_id, int __cmd, struct msqid_ds* _Nullable __buf) __INTRODUCED_IN(26);
/** Not useful on Android; disallowed by SELinux. */
int msgget(key_t __key, int __flags) __INTRODUCED_IN(26);
/** Not useful on Android; disallowed by SELinux. */
ssize_t msgrcv(int __msg_id, void* __msgbuf_ptr, size_t __size, long __type, int __flags) __INTRODUCED_IN(26);
ssize_t msgrcv(int __msg_id, void* _Nonnull __msgbuf_ptr, size_t __size, long __type, int __flags) __INTRODUCED_IN(26);
/** Not useful on Android; disallowed by SELinux. */
int msgsnd(int __msg_id, const void* __msgbuf_ptr, size_t __size, int __flags) __INTRODUCED_IN(26);
int msgsnd(int __msg_id, const void* _Nonnull __msgbuf_ptr, size_t __size, int __flags) __INTRODUCED_IN(26);
__END_DECLS

View file

@ -74,9 +74,12 @@ TEST(sys_msg, smoke) {
}
TEST(sys_msg, msgctl_failure) {
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wnonnull"
errno = 0;
ASSERT_EQ(-1, msgctl(-1, IPC_STAT, nullptr));
ASSERT_TRUE(errno == EINVAL || errno == ENOSYS);
#pragma clang diagnostic pop
}
TEST(sys_msg, msgget_failure) {
@ -86,9 +89,12 @@ TEST(sys_msg, msgget_failure) {
}
TEST(sys_msg, msgrcv_failure) {
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wnonnull"
errno = 0;
ASSERT_EQ(-1, msgrcv(-1, nullptr, 0, 0, 0));
ASSERT_TRUE(errno == EINVAL || errno == ENOSYS);
#pragma clang diagnostic pop
}
TEST(sys_msg, msgsnd_failure) {