From patchwork Thu May 5 03:01:08 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Xiaoming Ni X-Patchwork-Id: 53484 Return-Path: X-Original-To: patchwork@sourceware.org Delivered-To: patchwork@sourceware.org Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 8AC3E3857034 for ; Thu, 5 May 2022 03:03:03 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 8AC3E3857034 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1651719783; bh=oBJGyHGYkvmEphD1Vi8DUDsEKxLfqRQ/9ud5vAwZukc=; h=To:Subject:Date:In-Reply-To:References:List-Id:List-Unsubscribe: List-Archive:List-Post:List-Help:List-Subscribe:From:Reply-To:Cc: From; b=fucwc5EUc6xNEviVgiwrD06ollhtFlvlDkBX0AvNJ2RF4K9KrSxG/w/WEaoxXBORA WJoonVAW1KBacm1iFt55lY6229cqBleGl3aNT9NdRqNR742g3hLIhuZhuy4f0gtqfb BlQtcBjagH9PI3D69hVF2FB3FgW3iX26v8nJbMvg= X-Original-To: libc-alpha@sourceware.org Delivered-To: libc-alpha@sourceware.org Received: from szxga08-in.huawei.com (szxga08-in.huawei.com [45.249.212.255]) by sourceware.org (Postfix) with ESMTPS id 846013857413; Thu, 5 May 2022 03:01:16 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 846013857413 Received: from canpemm500006.china.huawei.com (unknown [172.30.72.56]) by szxga08-in.huawei.com (SkyGuard) with ESMTP id 4Ktz2d5Sm4z1JBqr; Thu, 5 May 2022 11:00:09 +0800 (CST) Received: from use12-sp2.huawei.com (10.67.189.174) by canpemm500006.china.huawei.com (7.192.105.130) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.24; Thu, 5 May 2022 11:01:13 +0800 To: , , , , , , Subject: [PATCH v2 1/4] adjtimex/adjtimex64: Use __nonnull to avoid null pointer Date: Thu, 5 May 2022 11:01:08 +0800 Message-ID: <20220505030111.111197-2-nixiaoming@huawei.com> X-Mailer: git-send-email 2.27.0 In-Reply-To: <20220505030111.111197-1-nixiaoming@huawei.com> References: <20220428122529.108208-1-nixiaoming@huawei.com> <20220505030111.111197-1-nixiaoming@huawei.com> MIME-Version: 1.0 X-Originating-IP: [10.67.189.174] X-ClientProxiedBy: dggems701-chm.china.huawei.com (10.3.19.178) To canpemm500006.china.huawei.com (7.192.105.130) X-CFilter-Loop: Reflected X-Spam-Status: No, score=-13.4 required=5.0 tests=BAYES_00, GIT_PATCH_0, KAM_DMARC_STATUS, KAM_MANYTO, SPF_HELO_NONE, SPF_PASS, TXREP, T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.4 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on server2.sourceware.org X-BeenThere: libc-alpha@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Libc-alpha mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-Patchwork-Original-From: Xiaoming Ni via Libc-alpha From: Xiaoming Ni Reply-To: Xiaoming Ni Cc: libc-alpha@sourceware.org, wangle6@huawei.com, nixiaoming@huawei.com Errors-To: libc-alpha-bounces+patchwork=sourceware.org@sourceware.org Sender: "Libc-alpha" Add __nonnull((1)) to the adjtimex()/adjtimex64() function declaration to avoid null pointer access. Link: https://sourceware.org/bugzilla/show_bug.cgi?id=27662 Link: https://sourceware.org/bugzilla/show_bug.cgi?id=29084 Signed-off-by: Xiaoming Ni Reviewed-by: Siddhesh Poyarekar --- sysdeps/unix/sysv/linux/include/sys/timex.h | 4 ++-- sysdeps/unix/sysv/linux/sys/timex.h | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/sysdeps/unix/sysv/linux/include/sys/timex.h b/sysdeps/unix/sysv/linux/include/sys/timex.h index 964a2c21f2..dd599b1c32 100644 --- a/sysdeps/unix/sysv/linux/include/sys/timex.h +++ b/sysdeps/unix/sysv/linux/include/sys/timex.h @@ -23,7 +23,7 @@ # ifndef _ISOMAC -extern int __adjtimex (struct timex *__ntx); +extern int __adjtimex (struct timex *__ntx) __nonnull ((1)); libc_hidden_proto (__adjtimex) # include @@ -79,7 +79,7 @@ struct __timex64 }; extern int __clock_adjtime64 (const clockid_t clock_id, struct __timex64 *tx64); libc_hidden_proto (__clock_adjtime64); -extern int ___adjtimex64 (struct __timex64 *tx64); +extern int ___adjtimex64 (struct __timex64 *tx64) __nonnull ((1)); libc_hidden_proto (___adjtimex64) struct __ntptimeval64 diff --git a/sysdeps/unix/sysv/linux/sys/timex.h b/sysdeps/unix/sysv/linux/sys/timex.h index 60d94814e8..430e47509d 100644 --- a/sysdeps/unix/sysv/linux/sys/timex.h +++ b/sysdeps/unix/sysv/linux/sys/timex.h @@ -55,7 +55,7 @@ struct ntptimeval __BEGIN_DECLS #ifndef __USE_TIME_BITS64 -extern int adjtimex (struct timex *__ntx) __THROW; +extern int adjtimex (struct timex *__ntx) __THROW __nonnull ((1)); extern int ntp_gettimex (struct ntptimeval *__ntv) __THROW; # ifdef __REDIRECT_NTH @@ -68,7 +68,7 @@ extern int ntp_adjtime (struct timex *__tntx) __THROW; #else # ifdef __REDIRECT_NTH extern int __REDIRECT_NTH (adjtimex, (struct timex *__ntx), - ___adjtimex64); + ___adjtimex64) __nonnull ((1)); extern int __REDIRECT_NTH (ntp_gettime, (struct ntptimeval *__ntv), __ntp_gettime64); extern int __REDIRECT_NTH (ntp_gettimex, (struct ntptimeval *__ntv), From patchwork Thu May 5 03:01:09 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Xiaoming Ni X-Patchwork-Id: 53485 Return-Path: X-Original-To: patchwork@sourceware.org Delivered-To: patchwork@sourceware.org Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 81A13385736B for ; Thu, 5 May 2022 03:03:45 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 81A13385736B DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1651719825; bh=lwZx0CTK3Tz1r4gJp76wjyDKc69y18NFQZBZjgqU8G8=; h=To:Subject:Date:In-Reply-To:References:List-Id:List-Unsubscribe: List-Archive:List-Post:List-Help:List-Subscribe:From:Reply-To:Cc: From; b=F0urEQl0E1zm5k4R4hzQ5GPU+hmTsw42XZA/FyvQsUtzqPMTw/9tDTRhUCaPd0Pig +j9KV967G0Q4e8FVUWTtLq0kJV17bySN6+5FYJHu0/dH/Yhz9RXR2eg4vxDAQjBU5s K5vfFHet71Odm115xtkXlMkVdC67yrRDGa8R1WVg= X-Original-To: libc-alpha@sourceware.org Delivered-To: libc-alpha@sourceware.org Received: from szxga02-in.huawei.com (szxga02-in.huawei.com [45.249.212.188]) by sourceware.org (Postfix) with ESMTPS id 87095385741C; Thu, 5 May 2022 03:01:16 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 87095385741C Received: from canpemm500006.china.huawei.com (unknown [172.30.72.56]) by szxga02-in.huawei.com (SkyGuard) with ESMTP id 4Ktz0k4FgTzGpVc; Thu, 5 May 2022 10:58:30 +0800 (CST) Received: from use12-sp2.huawei.com (10.67.189.174) by canpemm500006.china.huawei.com (7.192.105.130) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.24; Thu, 5 May 2022 11:01:13 +0800 To: , , , , , , Subject: [PATCH v2 2/4] ntp_xxxtimex: Use __nonnull to avoid null pointer Date: Thu, 5 May 2022 11:01:09 +0800 Message-ID: <20220505030111.111197-3-nixiaoming@huawei.com> X-Mailer: git-send-email 2.27.0 In-Reply-To: <20220505030111.111197-1-nixiaoming@huawei.com> References: <20220428122529.108208-1-nixiaoming@huawei.com> <20220505030111.111197-1-nixiaoming@huawei.com> MIME-Version: 1.0 X-Originating-IP: [10.67.189.174] X-ClientProxiedBy: dggems701-chm.china.huawei.com (10.3.19.178) To canpemm500006.china.huawei.com (7.192.105.130) X-CFilter-Loop: Reflected X-Spam-Status: No, score=-12.7 required=5.0 tests=BAYES_00, GIT_PATCH_0, KAM_DMARC_STATUS, KAM_MANYTO, SPF_HELO_NONE, SPF_PASS, TXREP, T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.4 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on server2.sourceware.org X-BeenThere: libc-alpha@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Libc-alpha mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-Patchwork-Original-From: Xiaoming Ni via Libc-alpha From: Xiaoming Ni Reply-To: Xiaoming Ni Cc: libc-alpha@sourceware.org, wangle6@huawei.com, nixiaoming@huawei.com Errors-To: libc-alpha-bounces+patchwork=sourceware.org@sourceware.org Sender: "Libc-alpha" ntp_gettime() ntp_gettime64() ntp_gettimex() ntp_gettimex64() ntp_adjtime() Add __nonnull((1)) to avoid null pointer access. Link: https://sourceware.org/bugzilla/show_bug.cgi?id=27662 Link: https://sourceware.org/bugzilla/show_bug.cgi?id=29084 Signed-off-by: Xiaoming Ni Reviewed-by: Siddhesh Poyarekar --- sysdeps/unix/sysv/linux/include/sys/timex.h | 4 ++-- sysdeps/unix/sysv/linux/sys/timex.h | 12 ++++++------ 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/sysdeps/unix/sysv/linux/include/sys/timex.h b/sysdeps/unix/sysv/linux/include/sys/timex.h index dd599b1c32..9d0da60640 100644 --- a/sysdeps/unix/sysv/linux/include/sys/timex.h +++ b/sysdeps/unix/sysv/linux/include/sys/timex.h @@ -94,9 +94,9 @@ struct __ntptimeval64 long int __glibc_reserved3; long int __glibc_reserved4; }; -extern int __ntp_gettime64 (struct __ntptimeval64 *ntv); +extern int __ntp_gettime64 (struct __ntptimeval64 *ntv) __nonnull ((1)); libc_hidden_proto (__ntp_gettime64) -extern int __ntp_gettimex64 (struct __ntptimeval64 *ntv); +extern int __ntp_gettimex64 (struct __ntptimeval64 *ntv) __nonnull ((1)); libc_hidden_proto (__ntp_gettimex64) # endif diff --git a/sysdeps/unix/sysv/linux/sys/timex.h b/sysdeps/unix/sysv/linux/sys/timex.h index 430e47509d..1a3d2fdb8d 100644 --- a/sysdeps/unix/sysv/linux/sys/timex.h +++ b/sysdeps/unix/sysv/linux/sys/timex.h @@ -56,25 +56,25 @@ __BEGIN_DECLS #ifndef __USE_TIME_BITS64 extern int adjtimex (struct timex *__ntx) __THROW __nonnull ((1)); -extern int ntp_gettimex (struct ntptimeval *__ntv) __THROW; +extern int ntp_gettimex (struct ntptimeval *__ntv) __THROW __nonnull ((1)); # ifdef __REDIRECT_NTH extern int __REDIRECT_NTH (ntp_gettime, (struct ntptimeval *__ntv), - ntp_gettimex); + ntp_gettimex) __nonnull ((1)); # else # define ntp_gettime ntp_gettimex # endif -extern int ntp_adjtime (struct timex *__tntx) __THROW; +extern int ntp_adjtime (struct timex *__tntx) __THROW __nonnull ((1)); #else # ifdef __REDIRECT_NTH extern int __REDIRECT_NTH (adjtimex, (struct timex *__ntx), ___adjtimex64) __nonnull ((1)); extern int __REDIRECT_NTH (ntp_gettime, (struct ntptimeval *__ntv), - __ntp_gettime64); + __ntp_gettime64) __nonnull ((1)); extern int __REDIRECT_NTH (ntp_gettimex, (struct ntptimeval *__ntv), - __ntp_gettimex64); + __ntp_gettimex64) __nonnull ((1)); extern int __REDIRECT_NTH (ntp_adjtime, (struct timex *__ntx), - ___adjtimex64); + ___adjtimex64) __nonnull ((1)); # else # define adjtimex ___adjtimex64 # define ntp_adjtime ___adjtimex64 From patchwork Thu May 5 03:01:10 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Xiaoming Ni X-Patchwork-Id: 53482 Return-Path: X-Original-To: patchwork@sourceware.org Delivered-To: patchwork@sourceware.org Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 1E13E385734F for ; Thu, 5 May 2022 03:01:39 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 1E13E385734F DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1651719699; bh=0L/1LoDP/t519yuFRSPbPrUaG1KL5M5Bh27AQ7toJqM=; h=To:Subject:Date:In-Reply-To:References:List-Id:List-Unsubscribe: List-Archive:List-Post:List-Help:List-Subscribe:From:Reply-To:Cc: From; b=MCMOCcz8zdmoEsjOX734lfz/j0dnjYqD60Q4we2bclpdPh6IDH9cs9HaErrUXY3Rv beDuUUfas+ybbTpS9n+hMDGDtNVeCkSvGsmUdXGqxug383Cvz/DCoozCGieYIBEkZP Go2wzARzf2k2jcK6QtVkt2JitlIWF5p+XZq3d6EQ= X-Original-To: libc-alpha@sourceware.org Delivered-To: libc-alpha@sourceware.org Received: from szxga01-in.huawei.com (szxga01-in.huawei.com [45.249.212.187]) by sourceware.org (Postfix) with ESMTPS id 5AAC63858025; Thu, 5 May 2022 03:01:16 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 5AAC63858025 Received: from canpemm500006.china.huawei.com (unknown [172.30.72.53]) by szxga01-in.huawei.com (SkyGuard) with ESMTP id 4Ktz3S3BHJzhXXG; Thu, 5 May 2022 11:00:52 +0800 (CST) Received: from use12-sp2.huawei.com (10.67.189.174) by canpemm500006.china.huawei.com (7.192.105.130) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.24; Thu, 5 May 2022 11:01:13 +0800 To: , , , , , , Subject: [PATCH v2 3/4] clock_adjtime: Use __nonnull to avoid null pointer Date: Thu, 5 May 2022 11:01:10 +0800 Message-ID: <20220505030111.111197-4-nixiaoming@huawei.com> X-Mailer: git-send-email 2.27.0 In-Reply-To: <20220505030111.111197-1-nixiaoming@huawei.com> References: <20220428122529.108208-1-nixiaoming@huawei.com> <20220505030111.111197-1-nixiaoming@huawei.com> MIME-Version: 1.0 X-Originating-IP: [10.67.189.174] X-ClientProxiedBy: dggems701-chm.china.huawei.com (10.3.19.178) To canpemm500006.china.huawei.com (7.192.105.130) X-CFilter-Loop: Reflected X-Spam-Status: No, score=-12.8 required=5.0 tests=BAYES_00, GIT_PATCH_0, KAM_DMARC_STATUS, KAM_MANYTO, SPF_HELO_NONE, SPF_PASS, TXREP, T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.4 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on server2.sourceware.org X-BeenThere: libc-alpha@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Libc-alpha mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-Patchwork-Original-From: Xiaoming Ni via Libc-alpha From: Xiaoming Ni Reply-To: Xiaoming Ni Cc: libc-alpha@sourceware.org, wangle6@huawei.com, nixiaoming@huawei.com Errors-To: libc-alpha-bounces+patchwork=sourceware.org@sourceware.org Sender: "Libc-alpha" clock_adjtime()/clock_adjtime64() Add __nonnull((2)) to avoid null pointer access. Link: https://sourceware.org/bugzilla/show_bug.cgi?id=27662 Link: https://sourceware.org/bugzilla/show_bug.cgi?id=29084 Signed-off-by: Xiaoming Ni Reviewed-by: Siddhesh Poyarekar --- sysdeps/unix/sysv/linux/bits/time.h | 4 ++-- sysdeps/unix/sysv/linux/include/sys/timex.h | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/sysdeps/unix/sysv/linux/bits/time.h b/sysdeps/unix/sysv/linux/bits/time.h index efb4a014df..0485a1e181 100644 --- a/sysdeps/unix/sysv/linux/bits/time.h +++ b/sysdeps/unix/sysv/linux/bits/time.h @@ -75,13 +75,13 @@ extern long int __sysconf (int); __BEGIN_DECLS /* Tune a POSIX clock. */ -extern int clock_adjtime (__clockid_t __clock_id, struct timex *__utx) __THROW; +extern int clock_adjtime (__clockid_t __clock_id, struct timex *__utx) __THROW __nonnull((2)); #ifdef __USE_TIME_BITS64 # if defined(__REDIRECT_NTH) extern int __REDIRECT_NTH (clock_adjtime, (__clockid_t __clock_id, struct timex *__utx), - __clock_adjtime64); + __clock_adjtime64) __nonnull((2)); # else # define clock_adjtime __clock_adjtime64 # endif diff --git a/sysdeps/unix/sysv/linux/include/sys/timex.h b/sysdeps/unix/sysv/linux/include/sys/timex.h index 9d0da60640..0c0261a06d 100644 --- a/sysdeps/unix/sysv/linux/include/sys/timex.h +++ b/sysdeps/unix/sysv/linux/include/sys/timex.h @@ -77,7 +77,7 @@ struct __timex64 int :32; int :32; }; -extern int __clock_adjtime64 (const clockid_t clock_id, struct __timex64 *tx64); +extern int __clock_adjtime64 (const clockid_t clock_id, struct __timex64 *tx64) __nonnull((2)); libc_hidden_proto (__clock_adjtime64); extern int ___adjtimex64 (struct __timex64 *tx64) __nonnull ((1)); libc_hidden_proto (___adjtimex64) From patchwork Thu May 5 03:01:11 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Xiaoming Ni X-Patchwork-Id: 53486 Return-Path: X-Original-To: patchwork@sourceware.org Delivered-To: patchwork@sourceware.org Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 95D8C3857018 for ; Thu, 5 May 2022 03:04:27 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 95D8C3857018 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1651719867; bh=GIX/fAlua4MTz4imXUl36iqZFUCcwA4bt+e8BhbDTj4=; h=To:Subject:Date:In-Reply-To:References:List-Id:List-Unsubscribe: List-Archive:List-Post:List-Help:List-Subscribe:From:Reply-To:Cc: From; b=muDbMUMJeE6Lb+ZWvBKvUJx+6ommXn9IDibYus+6JlkJNTHug8xOK10vE6L/01hFS Mb5y5pAD2p6MnGXShTa6o6OFm8178uUHuiVAr2tta57CvOjJG2ZInjc4ZNy/m31Sgw RLSy4PLBLsoCgAoJdVAVTQlS0VluXcodEnySkbWw= X-Original-To: libc-alpha@sourceware.org Delivered-To: libc-alpha@sourceware.org Received: from szxga02-in.huawei.com (szxga02-in.huawei.com [45.249.212.188]) by sourceware.org (Postfix) with ESMTPS id 8967A3857349; Thu, 5 May 2022 03:01:16 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 8967A3857349 Received: from canpemm500006.china.huawei.com (unknown [172.30.72.57]) by szxga02-in.huawei.com (SkyGuard) with ESMTP id 4Ktz0k74h2zGpWH; Thu, 5 May 2022 10:58:30 +0800 (CST) Received: from use12-sp2.huawei.com (10.67.189.174) by canpemm500006.china.huawei.com (7.192.105.130) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.24; Thu, 5 May 2022 11:01:14 +0800 To: , , , , , , Subject: [PATCH v2 4/4] clock_settime/clock_gettime: Use __nonnull to avoid null pointer Date: Thu, 5 May 2022 11:01:11 +0800 Message-ID: <20220505030111.111197-5-nixiaoming@huawei.com> X-Mailer: git-send-email 2.27.0 In-Reply-To: <20220505030111.111197-1-nixiaoming@huawei.com> References: <20220428122529.108208-1-nixiaoming@huawei.com> <20220505030111.111197-1-nixiaoming@huawei.com> MIME-Version: 1.0 X-Originating-IP: [10.67.189.174] X-ClientProxiedBy: dggems701-chm.china.huawei.com (10.3.19.178) To canpemm500006.china.huawei.com (7.192.105.130) X-CFilter-Loop: Reflected X-Spam-Status: No, score=-12.9 required=5.0 tests=BAYES_00, GIT_PATCH_0, KAM_DMARC_STATUS, KAM_MANYTO, SPF_HELO_NONE, SPF_PASS, TXREP, T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.4 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on server2.sourceware.org X-BeenThere: libc-alpha@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Libc-alpha mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-Patchwork-Original-From: Xiaoming Ni via Libc-alpha From: Xiaoming Ni Reply-To: Xiaoming Ni Cc: libc-alpha@sourceware.org, wangle6@huawei.com, nixiaoming@huawei.com Errors-To: libc-alpha-bounces+patchwork=sourceware.org@sourceware.org Sender: "Libc-alpha" clock_settime() clock_settime64() clock_gettime() clock_gettime64() Add __nonnull((2)) to avoid null pointer access. Link: https://sourceware.org/bugzilla/show_bug.cgi?id=27662 Link: https://sourceware.org/bugzilla/show_bug.cgi?id=29084 Signed-off-by: Xiaoming Ni Reviewed-by: Siddhesh Poyarekar --- include/time.h | 4 ++-- time/time.h | 11 +++++++---- 2 files changed, 9 insertions(+), 6 deletions(-) diff --git a/include/time.h b/include/time.h index 127347eb90..a64eff54f5 100644 --- a/include/time.h +++ b/include/time.h @@ -166,7 +166,7 @@ libc_hidden_proto (__timegm64) # define __clock_settime64 __clock_settime #else extern int __clock_settime64 (clockid_t clock_id, - const struct __timespec64 *tp); + const struct __timespec64 *tp) __nonnull((2)); libc_hidden_proto (__clock_settime64) #endif @@ -324,7 +324,7 @@ extern int __clock_nanosleep_time64 (clockid_t clock_id, int flags, const struct __timespec64 *req, struct __timespec64 *rem); libc_hidden_proto (__clock_nanosleep_time64) -extern int __clock_gettime64 (clockid_t clock_id, struct __timespec64 *tp); +extern int __clock_gettime64 (clockid_t clock_id, struct __timespec64 *tp) __nonnull((2)); libc_hidden_proto (__clock_gettime64) extern int __timespec_get64 (struct __timespec64 *ts, int base); libc_hidden_proto (__timespec_get64) diff --git a/time/time.h b/time/time.h index 847ac3f8c0..2cf89e6222 100644 --- a/time/time.h +++ b/time/time.h @@ -276,11 +276,12 @@ extern int nanosleep (const struct timespec *__requested_time, extern int clock_getres (clockid_t __clock_id, struct timespec *__res) __THROW; /* Get current value of clock CLOCK_ID and store it in TP. */ -extern int clock_gettime (clockid_t __clock_id, struct timespec *__tp) __THROW; +extern int clock_gettime (clockid_t __clock_id, struct timespec *__tp) + __THROW __nonnull((2)); /* Set clock CLOCK_ID to value TP. */ extern int clock_settime (clockid_t __clock_id, const struct timespec *__tp) - __THROW; + __THROW __nonnull((2)); # else # ifdef __REDIRECT extern int __REDIRECT (nanosleep, (const struct timespec *__requested_time, @@ -290,9 +291,11 @@ extern int __REDIRECT_NTH (clock_getres, (clockid_t __clock_id, struct timespec *__res), __clock_getres64); extern int __REDIRECT_NTH (clock_gettime, (clockid_t __clock_id, struct - timespec *__tp), __clock_gettime64); + timespec *__tp), __clock_gettime64) + __nonnull((2)); extern int __REDIRECT_NTH (clock_settime, (clockid_t __clock_id, const struct - timespec *__tp), __clock_settime64); + timespec *__tp), __clock_settime64) + __nonnull((2)); # else # define nanosleep __nanosleep64 # define clock_getres __clock_getres64