From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-16.7 required=3.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,UNPARSEABLE_RELAY,URIBL_BLOCKED, USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id BEA40C433E0 for ; Tue, 26 Jan 2021 10:49:55 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 94807221EB for ; Tue, 26 Jan 2021 10:49:55 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2404496AbhAZKtV (ORCPT ); Tue, 26 Jan 2021 05:49:21 -0500 Received: from out30-43.freemail.mail.aliyun.com ([115.124.30.43]:40416 "EHLO out30-43.freemail.mail.aliyun.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1731879AbhAZCbv (ORCPT ); Mon, 25 Jan 2021 21:31:51 -0500 X-Alimail-AntiSpam: AC=PASS;BC=-1|-1;BR=01201311R121e4;CH=green;DM=||false|;DS=||;FP=0|-1|-1|-1|0|-1|-1|-1;HT=e01e04426;MF=jefflexu@linux.alibaba.com;NM=1;PH=DS;RN=4;SR=0;TI=SMTPD_---0UMw3dyi_1611628266; Received: from localhost(mailfrom:jefflexu@linux.alibaba.com fp:SMTPD_---0UMw3dyi_1611628266) by smtp.aliyun-inc.com(127.0.0.1); Tue, 26 Jan 2021 10:31:06 +0800 From: Jeffle Xu To: linux-kernel@vger.kernel.org Cc: lkp@intel.com, joseph.qi@linux.alibaba.com, caspar@linux.alibaba.com Subject: [PATCH 2/2] thread_info: fix -Wsign-compare warnings Date: Tue, 26 Jan 2021 10:31:05 +0800 Message-Id: <20210126023105.13141-2-jefflexu@linux.alibaba.com> X-Mailer: git-send-email 2.27.0 In-Reply-To: <20210126023105.13141-1-jefflexu@linux.alibaba.com> References: <20210126023105.13141-1-jefflexu@linux.alibaba.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org warning: comparison of integers of different signs: 'int' and 'size_t' (aka 'unsigned long') [-Wsign-compare] if (unlikely(sz >= 0 && sz < bytes)) { Reported-by: kernel test robot Signed-off-by: Jeffle Xu --- include/linux/thread_info.h | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/include/linux/thread_info.h b/include/linux/thread_info.h index c8a974cead73..11b4b36116fa 100644 --- a/include/linux/thread_info.h +++ b/include/linux/thread_info.h @@ -179,15 +179,15 @@ __bad_copy_from(void); extern void __compiletime_error("copy destination size is too small") __bad_copy_to(void); -static inline void copy_overflow(int size, unsigned long count) +static inline void copy_overflow(unsigned long size, unsigned long count) { - WARN(1, "Buffer overflow detected (%d < %lu)!\n", size, count); + WARN(1, "Buffer overflow detected (%lu < %lu)!\n", size, count); } static __always_inline __must_check bool check_copy_size(const void *addr, size_t bytes, bool is_source) { - int sz = __compiletime_object_size(addr); + size_t sz = __compiletime_object_size(addr); if (unlikely(sz >= 0 && sz < bytes)) { if (!__builtin_constant_p(bytes)) copy_overflow(sz, bytes); -- 2.27.0