From patchwork Thu Apr 28 12:25:26 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Xiaoming Ni X-Patchwork-Id: 53311 X-Patchwork-Delegate: siddhesh@gotplt.org 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 EF7BE3857372 for ; Thu, 28 Apr 2022 12:28:41 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org EF7BE3857372 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1651148922; bh=qPVyt8WxkmWI0dm9AGaed4bguzWx10lWKyWV2JzbaCQ=; 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=q2T4bIuASjdbhpgPin7lins0UA3dopniXgh6Howr7wra+fI6uoGNbkjn8Bk2hglcl LizybnCkuGXRTx9aeKVxqL4NBWpgabu/xbiKQfghm/wzJWtvPmJ7YCzskG5vZ5CT5s ZhU3WiSbtHuO4lGhLcN081QZCyqQQOGPiUOeVqEk= 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 5D8853857374 for ; Thu, 28 Apr 2022 12:25:37 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 5D8853857374 Received: from canpemm500006.china.huawei.com (unknown [172.30.72.57]) by szxga08-in.huawei.com (SkyGuard) with ESMTP id 4KpvvB5zRyz1JBjC; Thu, 28 Apr 2022 20:24:38 +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, 28 Apr 2022 20:25:34 +0800 To: , , , , , Subject: [PATCH 1/4] adjtimex/adjtimex64: Use __nonnull to avoid null pointer Date: Thu, 28 Apr 2022 20:25:26 +0800 Message-ID: <20220428122529.108208-2-nixiaoming@huawei.com> X-Mailer: git-send-email 2.27.0 In-Reply-To: <20220428122529.108208-1-nixiaoming@huawei.com> References: <20220428122529.108208-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 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 Apr 28 12:25:27 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Xiaoming Ni X-Patchwork-Id: 53310 X-Patchwork-Delegate: siddhesh@gotplt.org 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 5EC1B385736D for ; Thu, 28 Apr 2022 12:28:00 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 5EC1B385736D DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1651148880; bh=7XoSd/iKVEYYnwd8hEAi80j4FHddlPGibtD6v8wTgl8=; 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=ydJqMv7pZF6wr8JChcm1txGd2ImU6PaXRVlTTYY/psoSBKNOQ5tD3e0V9HxxaclC/ hR+ejMDcJJ1ifdtDEtBs/bFT8A+dwTKzDg8ueG0LHfPSlfuc8TO7BmrDwwMDEIMbIK 1g6naB5p/UR3QIuB2gzmVqRAEAkMjdNzbFVTIKi4= 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 2D28E3856DC0 for ; Thu, 28 Apr 2022 12:25:37 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 2D28E3856DC0 Received: from canpemm500006.china.huawei.com (unknown [172.30.72.56]) by szxga08-in.huawei.com (SkyGuard) with ESMTP id 4KpvvC0F9Yz1JBhc; Thu, 28 Apr 2022 20:24:39 +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, 28 Apr 2022 20:25:34 +0800 To: , , , , , Subject: [PATCH 2/4] ntp_xxxtimex: Use __nonnull to avoid null pointer Date: Thu, 28 Apr 2022 20:25:27 +0800 Message-ID: <20220428122529.108208-3-nixiaoming@huawei.com> X-Mailer: git-send-email 2.27.0 In-Reply-To: <20220428122529.108208-1-nixiaoming@huawei.com> References: <20220428122529.108208-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 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 Apr 28 12:25:28 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Xiaoming Ni X-Patchwork-Id: 53309 X-Patchwork-Delegate: siddhesh@gotplt.org 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 4ED813857376 for ; Thu, 28 Apr 2022 12:27:18 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 4ED813857376 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1651148838; bh=Cw4KlvSGhC2TnIGVCfrfCkmliAsfiesCQSEAwT+KENo=; 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=NHY/bPth4GAH2vpBCW6K/1enIgktl8fGgh6UcZd4zVnN6vWCPJdLWrCKwqsjHQ9E8 rAUir7FahWj5xjGE7RT+LgcWMpBaDsgJV8U6IJusYsBflpeGO2jESSxlv2DwvL3BRN OFZiPZQBwRTWa91+f8+RYh12/My1KJANta5hcJk4= 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 3EC623856DC4 for ; Thu, 28 Apr 2022 12:25:37 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 3EC623856DC4 Received: from canpemm500006.china.huawei.com (unknown [172.30.72.56]) by szxga02-in.huawei.com (SkyGuard) with ESMTP id 4Kpvvt3tGLzhYmL; Thu, 28 Apr 2022 20:25:14 +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, 28 Apr 2022 20:25:34 +0800 To: , , , , , Subject: [PATCH 3/4] clock_adjtime: Use __nonnull to avoid null pointer Date: Thu, 28 Apr 2022 20:25:28 +0800 Message-ID: <20220428122529.108208-4-nixiaoming@huawei.com> X-Mailer: git-send-email 2.27.0 In-Reply-To: <20220428122529.108208-1-nixiaoming@huawei.com> References: <20220428122529.108208-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 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 Apr 28 12:25:29 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Xiaoming Ni X-Patchwork-Id: 53312 X-Patchwork-Delegate: siddhesh@gotplt.org 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 1A68D385734E for ; Thu, 28 Apr 2022 12:29:24 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 1A68D385734E DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1651148964; bh=ELeZUx+e9PPeU0jiGAfYsWXvcRXl2FAbwdusOJB+jFc=; 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=afS/XsbZblWaaQ3l1HlecoIE4HkpBdCrEEEyT8HkvW5fKxOd7SQJ/Q7NXOqroX1if Ftua1D+m72pW61+z7zt7SvZTmGvq0VgUXUHCY0Kv8kAVvw2reWrMTzfSvGqEsAgyyQ VSeDC2kGXMJmzLTkhm0qS9zDXWX4yXr0YvawMYbA= X-Original-To: libc-alpha@sourceware.org Delivered-To: libc-alpha@sourceware.org Received: from szxga03-in.huawei.com (szxga03-in.huawei.com [45.249.212.189]) by sourceware.org (Postfix) with ESMTPS id E02DE385737A for ; Thu, 28 Apr 2022 12:25:37 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org E02DE385737A Received: from canpemm500006.china.huawei.com (unknown [172.30.72.56]) by szxga03-in.huawei.com (SkyGuard) with ESMTP id 4Kpvq06G4TzCsPY; Thu, 28 Apr 2022 20:21:00 +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, 28 Apr 2022 20:25:34 +0800 To: , , , , , Subject: [PATCH 4/4] clock_settime/clock_gettime: Use __nonnull to avoid null pointer Date: Thu, 28 Apr 2022 20:25:29 +0800 Message-ID: <20220428122529.108208-5-nixiaoming@huawei.com> X-Mailer: git-send-email 2.27.0 In-Reply-To: <20220428122529.108208-1-nixiaoming@huawei.com> References: <20220428122529.108208-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.0 required=5.0 tests=BAYES_00, GIT_PATCH_0, KAM_DMARC_STATUS, KAM_MANYTO, SPF_HELO_NONE, SPF_PASS, TXREP 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 --- include/time.h | 4 ++-- time/time.h | 9 ++++++--- 2 files changed, 8 insertions(+), 5 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..26f276f147 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, @@ -291,8 +292,10 @@ extern int __REDIRECT_NTH (clock_getres, (clockid_t __clock_id, __clock_getres64); extern int __REDIRECT_NTH (clock_gettime, (clockid_t __clock_id, struct 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