From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (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 8D08335E958 for ; Sat, 28 Feb 2026 19:02:50 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1772305370; cv=none; b=OI4gIKtaCeX+CfgDRWbfArmsoCiRGmn4NqCucd4SE4XAnYt8p3ivyw7MwW9fEsKXj6Y0oQ5q2vNZXcwaSO7VBx6c2b7jIsSI9ct2SfzWS7d9qrTxVsx7eLj0Bu0Er3EOiRBTveLzpl2r6/D8GkxTKqYm/y7fCUNHgYd1YF07hy8= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1772305370; c=relaxed/simple; bh=gRWAWtCACv9lhxvNhJCLlbbiSPVjya6cne6BkfsMPJ0=; h=Date:From:To:Cc:Subject:Message-Id:In-Reply-To:References: Mime-Version:Content-Type; b=rHLpMo9QjIX0ff8bheRaVaG29pBeuEEXGXjn61iYLKGoas3rqpQjFWsrse198/pLdYbEdehKc4LM+pXGlE/lLU9YAipgVu9c0t27PToavozUIGrpulwGzj0E0zfvPu26GDxHwmbluIh7vkXmUvY3hmw5U2WIWYOwll7DXmN2M2U= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linux-foundation.org header.i=@linux-foundation.org header.b=U5AB7oxN; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linux-foundation.org header.i=@linux-foundation.org header.b="U5AB7oxN" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 02076C116D0; Sat, 28 Feb 2026 19:02:49 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linux-foundation.org; s=korg; t=1772305370; bh=gRWAWtCACv9lhxvNhJCLlbbiSPVjya6cne6BkfsMPJ0=; h=Date:From:To:Cc:Subject:In-Reply-To:References:From; b=U5AB7oxNsshAEwc7C7G+VGYGzAChV7yAr67vSQcwyRIp545X/NX0QMKq5HQ+CN90V R+K/2KaMW0CQ5qXP6znj+kikdZdfh/I0LVJgZQmSSjXsrKgPsgeTfA26mQ9IuTWNon fJTqUrdboWyFp77rs3VSjRI3m7jVmn1Wos1P7s88= Date: Sat, 28 Feb 2026 11:02:49 -0800 From: Andrew Morton To: Thorsten Blum Cc: Baoquan He , Vivek Goyal , Dave Young , kexec@lists.infradead.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH] crash_dump: Remove redundant less-than-zero check Message-Id: <20260228110249.8a4d13b872e7cf3ca75e11d0@linux-foundation.org> In-Reply-To: <20260228085136.861971-2-thorsten.blum@linux.dev> References: <20260228085136.861971-2-thorsten.blum@linux.dev> X-Mailer: Sylpheed 3.8.0beta1 (GTK+ 2.24.33; x86_64-pc-linux-gnu) Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit On Sat, 28 Feb 2026 09:51:36 +0100 Thorsten Blum wrote: > 'key_count' is an 'unsigned int' and cannot be less than zero. Remove > the redundant condition. > umm. OK. > --- a/kernel/crash_dump_dm_crypt.c > +++ b/kernel/crash_dump_dm_crypt.c > @@ -115,7 +115,7 @@ static int restore_dm_crypt_keys_to_thread_keyring(void) > > addr = dm_crypt_keys_addr; > dm_crypt_keys_read((char *)&key_count, sizeof(key_count), &addr); > - if (key_count < 0 || key_count > KEY_NUM_MAX) { > + if (key_count > KEY_NUM_MAX) { > kexec_dprintk("Failed to read the number of dm-crypt keys\n"); > return -1; > } iirc Linus has said "this is OK". The compiler will eliminate it and the code still works if the type is later changed to signed.