* [PATCH] fix pthread_mutexattr_gettype always return 0
@ 2023-03-02 7:54 abushwang(王烁)
2023-03-02 17:40 ` Carlos O'Donell
0 siblings, 1 reply; 2+ messages in thread
From: abushwang(王烁) @ 2023-03-02 7:54 UTC (permalink / raw)
To: libc-alpha, drepper.fsp
[-- Attachment #1: Type: text/plain, Size: 1015 bytes --]
From 03481285aff8d0d5a993f1969fb87afc946e2a91 Mon Sep 17 00:00:00 2001
From: Shuo Wang abushwang@tencent.com<mailto:abushwang@tencent.com>
Date: Thu, 2 Mar 2023 14:58:20 +0800
Subject: [PATCH] fix pthread_mutexattr_gettype always return 0
According to posix, pthread_mutexattr_gettype will return EINVAL
when the value specified by attr is invalid.
---
nptl/pthread_mutexattr_gettype.c | 3 +++
1 file changed, 3 insertions(+)
diff --git a/nptl/pthread_mutexattr_gettype.c b/nptl/pthread_mutexattr_gettype.c
index 21e0a9e946..ee5ee71a88 100644
--- a/nptl/pthread_mutexattr_gettype.c
+++ b/nptl/pthread_mutexattr_gettype.c
@@ -28,6 +28,9 @@ __pthread_mutexattr_gettype (const pthread_mutexattr_t *attr, int *kind)
*kind = (iattr->mutexkind & ~PTHREAD_MUTEXATTR_FLAG_BITS
& ~PTHREAD_MUTEX_NO_ELISION_NP);
+ if (kind < PTHREAD_MUTEX_NORMAL || kind > PTHREAD_MUTEX_ADAPTIVE_NP)
+ return EINVAL;
+
return 0;
}
versioned_symbol (libc, __pthread_mutexattr_gettype,
--
2.36.1
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: [PATCH] fix pthread_mutexattr_gettype always return 0
2023-03-02 7:54 [PATCH] fix pthread_mutexattr_gettype always return 0 abushwang(王烁)
@ 2023-03-02 17:40 ` Carlos O'Donell
0 siblings, 0 replies; 2+ messages in thread
From: Carlos O'Donell @ 2023-03-02 17:40 UTC (permalink / raw)
To: abushwang(王烁), libc-alpha
On 3/2/23 02:54, abushwang(王烁) via Libc-alpha wrote:
> From 03481285aff8d0d5a993f1969fb87afc946e2a91 Mon Sep 17 00:00:00 2001
> From: Shuo Wang abushwang@tencent.com<mailto:abushwang@tencent.com>
> Date: Thu, 2 Mar 2023 14:58:20 +0800
> Subject: [PATCH] fix pthread_mutexattr_gettype always return 0
>
> According to posix, pthread_mutexattr_gettype will return EINVAL
> when the value specified by attr is invalid.
Fails CI:
https://patchwork.sourceware.org/project/glibc/patch/c494dd3c4cc54544b14fc2f8ccea6266@tencent.com/
Patch fails to apply.
Please review the contribution checklist:
https://sourceware.org/glibc/wiki/Contribution%20checklist
> ---
> nptl/pthread_mutexattr_gettype.c | 3 +++
> 1 file changed, 3 insertions(+)
>
> diff --git a/nptl/pthread_mutexattr_gettype.c b/nptl/pthread_mutexattr_gettype.c
> index 21e0a9e946..ee5ee71a88 100644
> --- a/nptl/pthread_mutexattr_gettype.c
> +++ b/nptl/pthread_mutexattr_gettype.c
> @@ -28,6 +28,9 @@ __pthread_mutexattr_gettype (const pthread_mutexattr_t *attr, int *kind)
> *kind = (iattr->mutexkind & ~PTHREAD_MUTEXATTR_FLAG_BITS
> & ~PTHREAD_MUTEX_NO_ELISION_NP);
> + if (kind < PTHREAD_MUTEX_NORMAL || kind > PTHREAD_MUTEX_ADAPTIVE_NP)
> + return EINVAL;
> +
> return 0;
> }
> versioned_symbol (libc, __pthread_mutexattr_gettype,
> --
> 2.36.1
>
--
Cheers,
Carlos.
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2023-03-02 17:40 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-03-02 7:54 [PATCH] fix pthread_mutexattr_gettype always return 0 abushwang(王烁)
2023-03-02 17:40 ` Carlos O'Donell
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).