From patchwork Thu Apr 28 12:25:26 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Xiaoming Ni X-Patchwork-Id: 53311 X-Patchwork-Delegate: siddhesh@gotplt.org Return-Path: X-Original-To: patchwork@sourceware.org Delivered-To: patchwork@sourceware.org Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id EF7BE3857372 for ; Thu, 28 Apr 2022 12:28:41 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org EF7BE3857372 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1651148922; bh=qPVyt8WxkmWI0dm9AGaed4bguzWx10lWKyWV2JzbaCQ=; h=To:Subject:Date:In-Reply-To:References:List-Id:List-Unsubscribe: List-Archive:List-Post:List-Help:List-Subscribe:From:Reply-To:Cc: From; b=q2T4bIuASjdbhpgPin7lins0UA3dopniXgh6Howr7wra+fI6uoGNbkjn8Bk2hglcl LizybnCkuGXRTx9aeKVxqL4NBWpgabu/xbiKQfghm/wzJWtvPmJ7YCzskG5vZ5CT5s ZhU3WiSbtHuO4lGhLcN081QZCyqQQOGPiUOeVqEk= X-Original-To: libc-alpha@sourceware.org Delivered-To: libc-alpha@sourceware.org Received: from szxga08-in.huawei.com (szxga08-in.huawei.com [45.249.212.255]) by sourceware.org (Postfix) with ESMTPS id 5D8853857374 for ; Thu, 28 Apr 2022 12:25:37 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 5D8853857374 Received: from canpemm500006.china.huawei.com (unknown [172.30.72.57]) by szxga08-in.huawei.com (SkyGuard) with ESMTP id 4KpvvB5zRyz1JBjC; Thu, 28 Apr 2022 20:24:38 +0800 (CST) Received: from use12-sp2.huawei.com (10.67.189.174) by canpemm500006.china.huawei.com (7.192.105.130) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.24; Thu, 28 Apr 2022 20:25:34 +0800 To: , , , , , Subject: [PATCH 1/4] adjtimex/adjtimex64: Use __nonnull to avoid null pointer Date: Thu, 28 Apr 2022 20:25:26 +0800 Message-ID: <20220428122529.108208-2-nixiaoming@huawei.com> X-Mailer: git-send-email 2.27.0 In-Reply-To: <20220428122529.108208-1-nixiaoming@huawei.com> References: <20220428122529.108208-1-nixiaoming@huawei.com> MIME-Version: 1.0 X-Originating-IP: [10.67.189.174] X-ClientProxiedBy: dggems701-chm.china.huawei.com (10.3.19.178) To canpemm500006.china.huawei.com (7.192.105.130) X-CFilter-Loop: Reflected X-Spam-Status: No, score=-13.4 required=5.0 tests=BAYES_00, GIT_PATCH_0, KAM_DMARC_STATUS, KAM_MANYTO, SPF_HELO_NONE, SPF_PASS, TXREP autolearn=ham autolearn_force=no version=3.4.4 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on server2.sourceware.org X-BeenThere: libc-alpha@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Libc-alpha mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-Patchwork-Original-From: Xiaoming Ni via Libc-alpha From: Xiaoming Ni Reply-To: Xiaoming Ni Cc: libc-alpha@sourceware.org, wangle6@huawei.com, nixiaoming@huawei.com Errors-To: libc-alpha-bounces+patchwork=sourceware.org@sourceware.org Sender: "Libc-alpha" Add __nonnull((1)) to the adjtimex()/adjtimex64() function declaration 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 --- sysdeps/unix/sysv/linux/include/sys/timex.h | 4 ++-- sysdeps/unix/sysv/linux/sys/timex.h | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/sysdeps/unix/sysv/linux/include/sys/timex.h b/sysdeps/unix/sysv/linux/include/sys/timex.h index 964a2c21f2..dd599b1c32 100644 --- a/sysdeps/unix/sysv/linux/include/sys/timex.h +++ b/sysdeps/unix/sysv/linux/include/sys/timex.h @@ -23,7 +23,7 @@ # ifndef _ISOMAC -extern int __adjtimex (struct timex *__ntx); +extern int __adjtimex (struct timex *__ntx) __nonnull ((1)); libc_hidden_proto (__adjtimex) # include @@ -79,7 +79,7 @@ struct __timex64 }; extern int __clock_adjtime64 (const clockid_t clock_id, struct __timex64 *tx64); libc_hidden_proto (__clock_adjtime64); -extern int ___adjtimex64 (struct __timex64 *tx64); +extern int ___adjtimex64 (struct __timex64 *tx64) __nonnull ((1)); libc_hidden_proto (___adjtimex64) struct __ntptimeval64 diff --git a/sysdeps/unix/sysv/linux/sys/timex.h b/sysdeps/unix/sysv/linux/sys/timex.h index 60d94814e8..430e47509d 100644 --- a/sysdeps/unix/sysv/linux/sys/timex.h +++ b/sysdeps/unix/sysv/linux/sys/timex.h @@ -55,7 +55,7 @@ struct ntptimeval __BEGIN_DECLS #ifndef __USE_TIME_BITS64 -extern int adjtimex (struct timex *__ntx) __THROW; +extern int adjtimex (struct timex *__ntx) __THROW __nonnull ((1)); extern int ntp_gettimex (struct ntptimeval *__ntv) __THROW; # ifdef __REDIRECT_NTH @@ -68,7 +68,7 @@ extern int ntp_adjtime (struct timex *__tntx) __THROW; #else # ifdef __REDIRECT_NTH extern int __REDIRECT_NTH (adjtimex, (struct timex *__ntx), - ___adjtimex64); + ___adjtimex64) __nonnull ((1)); extern int __REDIRECT_NTH (ntp_gettime, (struct ntptimeval *__ntv), __ntp_gettime64); extern int __REDIRECT_NTH (ntp_gettimex, (struct ntptimeval *__ntv),