From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail.zytor.com (terminus.zytor.com [198.137.202.136]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id D600E3A7842 for ; Tue, 20 Jan 2026 20:25:28 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=198.137.202.136 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1768940730; cv=none; b=BwcM+xVpPZo1CIN0YW4QaDEx4PPuO+SO9k1qWMlzJQw1/rYVuLyzm1WQDPn52F2ZJNCLftJD5vorlfeTsmd83LPcOboDV6opmAU+f5ghjwdaYKT7sDtJ8sTPzo8zPfvy5tHlFuHxfwGssrRvUzKzypw1lEWvcm1LeouPDvjn+u4= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1768940730; c=relaxed/simple; bh=jHht03l0QhC92kgPXZO9BnVauW8AmObnrnGjT8IhRRQ=; h=Message-ID:Date:MIME-Version:Subject:To:Cc:References:From: In-Reply-To:Content-Type; b=PGeA9nVTymWuFox2Y1bXO9OduyzQZi6C+g00XjKjLenkk6ybHvDX71VQGKoyL574vT7/C0QfAO01DrpgML+lFsk3xxHJOpTjwkWagY94nEwuXJ3jI+cvBW/lRH6/ev6jP/XddeaVM4Kef3G1OrE6a+1pUF1VfZ6ZgvpIOjj8NHI= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=zytor.com; spf=pass smtp.mailfrom=zytor.com; dkim=pass (2048-bit key) header.d=zytor.com header.i=@zytor.com header.b=WvC/GD43; arc=none smtp.client-ip=198.137.202.136 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=zytor.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=zytor.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=zytor.com header.i=@zytor.com header.b="WvC/GD43" Received: from [IPV6:2601:646:8081:9483:12c5:bc8e:d949:3497] ([IPv6:2601:646:8081:9483:12c5:bc8e:d949:3497]) (authenticated bits=0) by mail.zytor.com (8.18.1/8.17.1) with ESMTPSA id 60KKOCUd3952375 (version=TLSv1.3 cipher=TLS_AES_128_GCM_SHA256 bits=128 verify=NO); Tue, 20 Jan 2026 12:24:49 -0800 DKIM-Filter: OpenDKIM Filter v2.11.0 mail.zytor.com 60KKOCUd3952375 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=zytor.com; s=2025122301; t=1768940689; bh=FRouShQT0zBzYM7laqMJP+BK92QsWeiQfeisAgTPa8M=; h=Date:Subject:To:Cc:References:From:In-Reply-To:From; b=WvC/GD43cYfylshGUVvBd0vCEHdk7zkbCguzuFZ2a52nmmKvWMRNuYJUkZbzVl1KY t7MURW+BRWYJZHci6uFgXt3AYrkB1QO9m7OO12ng12lGXI74bIxHlxvHg4A0EuBteq pS4EaWdBJMr4BXG5SX2UCCBlpExd9lcdPt6uVg1gV5k1HmmGr1VMs/Jbe6FiEiwHQy LL2dT78uh4uVHPTVaPjhj6IvqAolpfPskLzttJ5dJiA2uJoykvuJWaRTbxemx0O98u 46AnpAc4ISAp2/lLXTLaeKEII5LPCY/aBEufuSeEiZSNW1S1GYAVUr89q+e86K+jB2 umDrC85zZ0oJg== Message-ID: <417e3654-27bf-4fc4-8adb-36ec6010f027@zytor.com> Date: Tue, 20 Jan 2026 12:24:07 -0800 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH] x86/lib: Fix num_digits() signed overflow for INT_MIN To: David Desobry , Borislav Petkov Cc: tglx@kernel.org, mingo@redhat.com, dave.hansen@linux.intel.com, x86@kernel.org, linux-kernel@vger.kernel.org References: <20260120094258.41313-1-david.desobry@formalgen.com> <53DB5B87-BA96-44B1-AE1B-9055CB7B9350@zytor.com> <20260120164050.GBaW-wEvzp9WVFj9n9@fat_crate.local> <7C458D74-49E8-4FFE-BD60-74CA3ABFDC6C@zytor.com> <20260120191655.GDaW_Up2ZOv5AHhbq7@fat_crate.local> <14738799-afb2-428b-9829-f1ed038f3872@formalgen.com> Content-Language: en-US, sv-SE From: "H. Peter Anvin" In-Reply-To: <14738799-afb2-428b-9829-f1ed038f3872@formalgen.com> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit On 2026-01-20 12:16, David Desobry wrote: > I haven't hit this corner case in practice; I was just auditing the code and > noticed the corner case overflow leading to wrong logic. > Then in a v2 version I brought some design improvement (switch case). The switch is a good improvement. I would say, though, that if we don't need signed input then we should just take out the minus handling code and have the function take an unsigned int as input. -hpa