aboutsummaryrefslogtreecommitdiff
path: root/time
diff options
context:
space:
mode:
authorXiaoming Ni <nixiaoming@huawei.com>2022-05-05 11:01:11 +0800
committerSiddhesh Poyarekar <siddhesh@sourceware.org>2022-05-05 17:48:04 +0530
commitcf73acb596e39af4bd9f32846552cd41d9e17a78 (patch)
treecabece628862ed0abcadc51ae5bfb6fc415ba6e8 /time
parented2ddeffa5d4a51a0d7fe8af701e86cb2fd4ce05 (diff)
downloadglibc-cf73acb596e39af4bd9f32846552cd41d9e17a78.zip
glibc-cf73acb596e39af4bd9f32846552cd41d9e17a78.tar.gz
glibc-cf73acb596e39af4bd9f32846552cd41d9e17a78.tar.bz2
clock_settime/clock_gettime: Use __nonnull to avoid null pointer
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 <nixiaoming@huawei.com> Reviewed-by: Siddhesh Poyarekar <siddhesh@sourceware.org>
Diffstat (limited to 'time')
-rw-r--r--time/time.h11
1 files changed, 7 insertions, 4 deletions
diff --git a/time/time.h b/time/time.h
index 847ac3f..2cf89e6 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