mbox

[v2,0/4] time: Use __nonnull to avoid null pointer

Message ID 20220505030111.111197-1-nixiaoming@huawei.com
Headers

Message

Xiaoming Ni May 5, 2022, 3:01 a.m. UTC
  Some external interface codes do not check whether the pointer parameter
 is null. If the parameter is null, the program crashes (BZ#27662).
Therefore, add a __nonull statement to the function declaration to avoid
 null pointers.

Link: https://sourceware.org/bugzilla/show_bug.cgi?id=27662
Link: https://sourceware.org/bugzilla/show_bug.cgi?id=29084

The __nonull declaration is added for the following interfaces:
	adjtimex()
	adjtimex64()
	ntp_gettime()
	ntp_gettime64()
	ntp_gettimex()
	ntp_gettimex64()
	ntp_adjtime()
	clock_settime()
	clock_settime64()
	clock_gettime()
	clock_gettime64()
	clock_adjtime()
	clock_adjtime64()
--
v2:
  fix the compilation error caused by missing semicolons.
  Thanks Siddhesh Poyarekar for the review.
v1: https://public-inbox.org/libc-alpha/20220428122529.108208-1-nixiaoming@huawei.com/

--

Xiaoming Ni (4):
  adjtimex/adjtimex64: Use __nonnull to avoid null pointer
  ntp_xxxtimex: Use __nonnull to avoid null pointer
  clock_adjtime: Use __nonnull to avoid null pointer
  clock_settime/clock_gettime: Use __nonnull to avoid null pointer

 include/time.h                              |  4 ++--
 sysdeps/unix/sysv/linux/bits/time.h         |  4 ++--
 sysdeps/unix/sysv/linux/include/sys/timex.h | 10 +++++-----
 sysdeps/unix/sysv/linux/sys/timex.h         | 16 ++++++++--------
 time/time.h                                 | 11 +++++++----
 5 files changed, 24 insertions(+), 21 deletions(-)