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 <nixiaoming@huawei.com>
Reviewed-by: Siddhesh Poyarekar <siddhesh@sourceware.org>
This commit is contained in:
Xiaoming Ni 2022-05-05 11:01:09 +08:00 committed by Siddhesh Poyarekar
parent d62a70fda8
commit 6a9786b8ec
2 changed files with 8 additions and 8 deletions

View File

@ -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

View File

@ -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