From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 2206) id 847E23865C28; Thu, 5 May 2022 12:25:24 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 847E23865C28 Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit From: Siddhesh Poyarekar To: glibc-cvs@sourceware.org Subject: [glibc] ntp_xxxtimex: Use __nonnull to avoid null pointer X-Act-Checkin: glibc X-Git-Author: Xiaoming Ni X-Git-Refname: refs/heads/master X-Git-Oldrev: d62a70fda8c7d772191ca8781dca46714efdd8cc X-Git-Newrev: 6a9786b8ecf84a23f9d108a46f58e9fcca70c4a9 Message-Id: <20220505122524.847E23865C28@sourceware.org> Date: Thu, 5 May 2022 12:25:24 +0000 (GMT) X-BeenThere: glibc-cvs@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Glibc-cvs mailing list List-Unsubscribe: , List-Archive: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 05 May 2022 12:25:24 -0000 https://sourceware.org/git/gitweb.cgi?p=glibc.git;h=6a9786b8ecf84a23f9d108a46f58e9fcca70c4a9 commit 6a9786b8ecf84a23f9d108a46f58e9fcca70c4a9 Author: Xiaoming Ni Date: Thu May 5 11:01:09 2022 +0800 ntp_xxxtimex: Use __nonnull to avoid null pointer 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 Diff: --- 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