From patchwork Thu May 5 03:01:10 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Xiaoming Ni X-Patchwork-Id: 53482 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 1E13E385734F for ; Thu, 5 May 2022 03:01:39 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 1E13E385734F DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1651719699; bh=0L/1LoDP/t519yuFRSPbPrUaG1KL5M5Bh27AQ7toJqM=; 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=MCMOCcz8zdmoEsjOX734lfz/j0dnjYqD60Q4we2bclpdPh6IDH9cs9HaErrUXY3Rv beDuUUfas+ybbTpS9n+hMDGDtNVeCkSvGsmUdXGqxug383Cvz/DCoozCGieYIBEkZP Go2wzARzf2k2jcK6QtVkt2JitlIWF5p+XZq3d6EQ= X-Original-To: libc-alpha@sourceware.org Delivered-To: libc-alpha@sourceware.org Received: from szxga01-in.huawei.com (szxga01-in.huawei.com [45.249.212.187]) by sourceware.org (Postfix) with ESMTPS id 5AAC63858025; Thu, 5 May 2022 03:01:16 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 5AAC63858025 Received: from canpemm500006.china.huawei.com (unknown [172.30.72.53]) by szxga01-in.huawei.com (SkyGuard) with ESMTP id 4Ktz3S3BHJzhXXG; Thu, 5 May 2022 11:00:52 +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, 5 May 2022 11:01:13 +0800 To: , , , , , , Subject: [PATCH v2 3/4] clock_adjtime: Use __nonnull to avoid null pointer Date: Thu, 5 May 2022 11:01:10 +0800 Message-ID: <20220505030111.111197-4-nixiaoming@huawei.com> X-Mailer: git-send-email 2.27.0 In-Reply-To: <20220505030111.111197-1-nixiaoming@huawei.com> References: <20220428122529.108208-1-nixiaoming@huawei.com> <20220505030111.111197-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=-12.8 required=5.0 tests=BAYES_00, GIT_PATCH_0, KAM_DMARC_STATUS, KAM_MANYTO, SPF_HELO_NONE, SPF_PASS, TXREP, T_SCC_BODY_TEXT_LINE 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" 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 --- 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)