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 DF56F23645D for ; Sun, 30 Nov 2025 22:53:47 +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=1764543229; cv=none; b=MOCfCyW8FUY/b93MRPEIt1JjkMUKxPL8fM801k7P/omhHj1PsXF8SBVKQF2siqvPPTunA+jSNts4jvFoAiAeKznQ4ZKa6PB7W+6Jp8biQAAUXPPZLyku5vJNXmtTkTUNauEdYkoco9fWpTApc3hFpG1Vbq31fIZul5F4NZim+gA= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1764543229; c=relaxed/simple; bh=dDXZN6yfuCJpIxHqhXrL/OshBzxUGz09wFG/LrqUbkE=; h=From:To:Cc:Subject:In-Reply-To:References:Date:Message-ID: MIME-Version:Content-Type; b=HvhIu6ntiA0EGrP8pU8NdcScfnpdOb6ufI5nmswylBA7gAHi6RWyCFLvzk9B6GYsK2o4PhM4+ziKBv0X4UuVFs8BVMUqB9EhggDKxEH5Xan3M+6DInWHCFy22Qw+0NgDarjhDXDy/HcRsU7lhBaDY/Ge6Lp1k2+udF0xakJflNE= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=BxtcyWLN; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="BxtcyWLN" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 7D45EC4CEF8; Sun, 30 Nov 2025 22:53:45 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1764543227; bh=dDXZN6yfuCJpIxHqhXrL/OshBzxUGz09wFG/LrqUbkE=; h=From:To:Cc:Subject:In-Reply-To:References:Date:From; b=BxtcyWLNCEPHr7mUdEW0SOd47sCFuUXFpsIonfxcF4PTL0hXAtied1L9lyTfVPQLC oQuf+Wv7E3qwZWSdjorXHZZDP0pp/acJw8bCyvWzBHA6sQiOwPbyI6X6JCBn0Ym+b6 X1yLATfFGAtlsKUJggVIxr632ZvZE/wGiwQWAmoD8A7cvzVRINjkJLsbuQkOC/p95P LHPiOPlruVhOs5+WYEk6V7y1eGVZPNumqsGCZi8JwELyIT1rg8yw9l50kcx9FAAVjF 9/iOkxVpuwxm1y0uEBWrfJayokUcXjk85ZskmtGgfkZ42Uc7XeXe9VfQV5eJMTHpGB 111HYgIgvFnQQ== From: Pratyush Yadav To: Pasha Tatashin Cc: pratyush@kernel.org, rppt@kernel.org, dmatlack@google.com, akpm@linux-foundation.org, linux-kernel@vger.kernel.org, linux-mm@kvack.org Subject: Re: [PATCH] liveupdate: luo_core: fix redundant bound check in luo_ioctl() In-Reply-To: <20251130010919.1488230-1-pasha.tatashin@soleen.com> (Pasha Tatashin's message of "Sat, 29 Nov 2025 20:09:19 -0500") References: <20251130010919.1488230-1-pasha.tatashin@soleen.com> Date: Sun, 30 Nov 2025 23:53:42 +0100 Message-ID: <86v7irm8sp.fsf@kernel.org> User-Agent: Gnus/5.13 (Gnus v5.13) Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain On Sat, Nov 29 2025, Pasha Tatashin wrote: > The kernel test robot reported a Smatch warning: > kernel/liveupdate/luo_core.c:402 luo_ioctl() warn: unsigned 'nr' is > never less than zero. > > This occurs because 'nr' is unsigned and LIVEUPDATE_CMD_BASE is > currently defined as 0, making the check (nr < LIVEUPDATE_CMD_BASE) > always false. > > Remove the explicit lower bound check. The logic remains correct because > 'nr' is unsigned; if nr is less than LIVEUPDATE_CMD_BASE, the expression > (nr - LIVEUPDATE_CMD_BASE) will wrap around to a large positive value. > This will inevitably be larger than ARRAY_SIZE(luo_ioctl_ops) and be > caught by the upper bound check. > > Reported-by: kernel test robot > Closes: https://lore.kernel.org/oe-kbuild-all/202511280300.6pvBmXUS-lkp@intel.com/ > Signed-off-by: Pasha Tatashin Reviewed-by: Pratyush Yadav [...] -- Regards, Pratyush Yadav