From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: 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 From: Xiaoming Ni To: , , , , , CC: , , 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 Content-Transfer-Encoding: 8bit Content-Type: text/plain 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-List-Received-Date: Thu, 28 Apr 2022 12:25:39 -0000 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 --- 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 -- 2.27.0