Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753248AbbF0RDO (ORCPT ); Sat, 27 Jun 2015 13:03:14 -0400 Received: from forward8l.mail.yandex.net ([84.201.143.141]:44596 "EHLO forward8l.mail.yandex.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751529AbbF0RDH (ORCPT ); Sat, 27 Jun 2015 13:03:07 -0400 X-Greylist: delayed 328 seconds by postgrey-1.27 at vger.kernel.org; Sat, 27 Jun 2015 13:03:07 EDT Authentication-Results: smtp3o.mail.yandex.net; dkim=pass header.i=@corrigendum.ru From: =?UTF-8?q?=D0=A0=D0=BE=D0=BC=D0=B0=D0=BD=20=D0=94=D0=BE=D0=BD=D1=87=D0=B5=D0=BD=D0=BA=D0=BE?= To: tglx@linutronix.de, mingo@redhat.com, hpa@zytor.com Cc: x86@kernel.org, linux-kernel@vger.kernel.org, trivial@kernel.org Subject: [PATCH] x86: fix -Wsign-compare warnings in uaccess.h Date: Sat, 27 Jun 2015 19:57:25 +0300 Message-Id: <1435424245-5160-1-git-send-email-dpb@corrigendum.ru> X-Mailer: git-send-email 2.4.4 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1339 Lines: 37 The casts are safe, since those conditions are only evaluated when sz >= 0. Signed-off-by: Роман Донченко --- arch/x86/include/asm/uaccess.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/arch/x86/include/asm/uaccess.h b/arch/x86/include/asm/uaccess.h index a8df874..4c47002 100644 --- a/arch/x86/include/asm/uaccess.h +++ b/arch/x86/include/asm/uaccess.h @@ -714,7 +714,7 @@ copy_from_user(void *to, const void __user *from, unsigned long n) * case, and do only runtime checking for non-constant sizes. */ - if (likely(sz < 0 || sz >= n)) + if (likely(sz < 0 || (unsigned)sz >= n)) n = _copy_from_user(to, from, n); else if(__builtin_constant_p(n)) copy_from_user_overflow(); @@ -732,7 +732,7 @@ copy_to_user(void __user *to, const void *from, unsigned long n) might_fault(); /* See the comment in copy_from_user() above. */ - if (likely(sz < 0 || sz >= n)) + if (likely(sz < 0 || (unsigned)sz >= n)) n = _copy_to_user(to, from, n); else if(__builtin_constant_p(n)) copy_to_user_overflow(); -- 2.3.2 -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/