Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932217AbcLHLFi (ORCPT ); Thu, 8 Dec 2016 06:05:38 -0500 Received: from aserp1040.oracle.com ([141.146.126.69]:30847 "EHLO aserp1040.oracle.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752695AbcLHLFK (ORCPT ); Thu, 8 Dec 2016 06:05:10 -0500 Date: Thu, 8 Dec 2016 13:56:03 +0300 From: Dan Carpenter To: Thomas Gleixner Cc: Ingo Molnar , "H. Peter Anvin" , x86@kernel.org, Dave Hansen , Andrew Morton , Andrey Ryabinin , Andy Lutomirski , linux-kernel@vger.kernel.org, kernel-janitors@vger.kernel.org Subject: [patch] x86/ldt: make a size variable unsigned Message-ID: <20161208105602.GA11382@elgon.mountain> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline User-Agent: Mutt/1.5.21 (2010-09-15) X-Source-IP: aserv0021.oracle.com [141.146.126.233] Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 868 Lines: 23 My static checker complains that we put an upper bound on the "size" variable but not a lower bound. The checker is not smart enough to know the possible ranges of "old_mm->context.ldt->size" from init_new_context_ldt() so it thinks maybe it could be negative. Let's make it unsigned to silence the warning and future proof the code a bit. Signed-off-by: Dan Carpenter diff --git a/arch/x86/kernel/ldt.c b/arch/x86/kernel/ldt.c index 4d12cdf2b453..d6320c63be45 100644 --- a/arch/x86/kernel/ldt.c +++ b/arch/x86/kernel/ldt.c @@ -34,7 +34,7 @@ static void flush_ldt(void *current_mm) } /* The caller must call finalize_ldt_struct on the result. LDT starts zeroed. */ -static struct ldt_struct *alloc_ldt_struct(int size) +static struct ldt_struct *alloc_ldt_struct(unsigned int size) { struct ldt_struct *new_ldt; int alloc_size;