From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 2206) id 9F6893851C02; Thu, 5 May 2022 12:25:29 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 9F6893851C02 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] clock_adjtime: Use __nonnull to avoid null pointer X-Act-Checkin: glibc X-Git-Author: Xiaoming Ni X-Git-Refname: refs/heads/master X-Git-Oldrev: 6a9786b8ecf84a23f9d108a46f58e9fcca70c4a9 X-Git-Newrev: ed2ddeffa5d4a51a0d7fe8af701e86cb2fd4ce05 Message-Id: <20220505122529.9F6893851C02@sourceware.org> Date: Thu, 5 May 2022 12:25:29 +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:29 -0000 https://sourceware.org/git/gitweb.cgi?p=glibc.git;h=ed2ddeffa5d4a51a0d7fe8af701e86cb2fd4ce05 commit ed2ddeffa5d4a51a0d7fe8af701e86cb2fd4ce05 Author: Xiaoming Ni Date: Thu May 5 11:01:10 2022 +0800 clock_adjtime: Use __nonnull to avoid null pointer clock_adjtime()/clock_adjtime64() 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 Reviewed-by: Siddhesh Poyarekar Diff: --- sysdeps/unix/sysv/linux/bits/time.h | 4 ++-- sysdeps/unix/sysv/linux/include/sys/timex.h | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/sysdeps/unix/sysv/linux/bits/time.h b/sysdeps/unix/sysv/linux/bits/time.h index efb4a014df..0485a1e181 100644 --- a/sysdeps/unix/sysv/linux/bits/time.h +++ b/sysdeps/unix/sysv/linux/bits/time.h @@ -75,13 +75,13 @@ extern long int __sysconf (int); __BEGIN_DECLS /* Tune a POSIX clock. */ -extern int clock_adjtime (__clockid_t __clock_id, struct timex *__utx) __THROW; +extern int clock_adjtime (__clockid_t __clock_id, struct timex *__utx) __THROW __nonnull((2)); #ifdef __USE_TIME_BITS64 # if defined(__REDIRECT_NTH) extern int __REDIRECT_NTH (clock_adjtime, (__clockid_t __clock_id, struct timex *__utx), - __clock_adjtime64); + __clock_adjtime64) __nonnull((2)); # else # define clock_adjtime __clock_adjtime64 # endif diff --git a/sysdeps/unix/sysv/linux/include/sys/timex.h b/sysdeps/unix/sysv/linux/include/sys/timex.h index 9d0da60640..0c0261a06d 100644 --- a/sysdeps/unix/sysv/linux/include/sys/timex.h +++ b/sysdeps/unix/sysv/linux/include/sys/timex.h @@ -77,7 +77,7 @@ struct __timex64 int :32; int :32; }; -extern int __clock_adjtime64 (const clockid_t clock_id, struct __timex64 *tx64); +extern int __clock_adjtime64 (const clockid_t clock_id, struct __timex64 *tx64) __nonnull((2)); libc_hidden_proto (__clock_adjtime64); extern int ___adjtimex64 (struct __timex64 *tx64) __nonnull ((1)); libc_hidden_proto (___adjtimex64)