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 B700C283FD9 for ; Sun, 14 Dec 2025 08:26:55 +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=1765700815; cv=none; b=jYv8hHubhLqVM07z093Ovz3kZQ7IRFqToezByVwtWVul6LSiTpj018w0FA6BavwGNTrZeICC19bFGynQAnaR/nDJkp/fl5cwWQVUQK/EXA7UOrM2GCFhfbe4KeNQr6NRckGEOdAV74iQv/7Ic6kM068D1rzxnwPtJFdduZpqvJc= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1765700815; c=relaxed/simple; bh=1r1nKx7W6Gg5YnhtTKbbjsjyID72FC3YUAz+jDtaSwg=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=r8Oq3KL90r4N2ssXC9ud2CLZ/S3JhXM7+4BQBOEABhPmsgwBM/XCH7oYTKuX/mLWU+7BDNCcLJjTw17cJA/W6ABsdKxZQSDwZ829I2VvLvREyIVp0iEeTloK9BBlmCceSQTBpqbXHS164q3c5HZ4BOx5acm+DknYn/nbZmee/Pk= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=tVYxkztK; 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="tVYxkztK" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 742A2C4CEF1; Sun, 14 Dec 2025 08:26:52 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1765700815; bh=1r1nKx7W6Gg5YnhtTKbbjsjyID72FC3YUAz+jDtaSwg=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=tVYxkztKHsfR/+3Jx9HgMlgpq5fO4zFlrC2y47H0XSP0wevmR05tS3NXlH5dogT+M lrCxY7SOTcVMcQX9RPsve817yCtyfLIjvr/6mSibAHyZk4VFCncdy7qt2+53ilunEJ XrqU/6xJ8K03bE0yusYn9phU7K1/h3nxxyoqUzxR8CyAx1Sqo6gGJdY4OiN9LDH3+L QzN1mgitz8kaIpIUvzwiC/3yt0u47aWRmoV2tgzjd9rW3IMiV4TvUXA8YFNKAV+ywJ LxL6xmiuCUQLMku+UHPJkervMYzARIN5SSmDyGY4D83BvuKqs/bPdurjnVZRokUJZY xmKFp7G+VgfSQ== Date: Sun, 14 Dec 2025 09:26:50 +0100 From: Ingo Molnar To: Nikolay Borisov Cc: linux-kernel@vger.kernel.org, Andy Shevchenko , Arnd Bergmann , Borislav Petkov , Juergen Gross , "H . Peter Anvin" , Kees Cook , Linus Torvalds , Mike Rapoport , Paul Menzel , Peter Zijlstra , Thomas Gleixner , David Woodhouse Subject: Re: [PATCH 32/32] x86/boot/e820: Move index increments outside accessors in e820__update_table() Message-ID: References: <20250515120549.2820541-1-mingo@kernel.org> <20250515120549.2820541-33-mingo@kernel.org> 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-Disposition: inline In-Reply-To: * Nikolay Borisov wrote: > > > On 5/15/25 15:05, Ingo Molnar wrote: > > This kind of code: > > > > change_point[chg_idx++]->entry = &entries[idx]; > > > > Can be a bit confusing to human readers, and GCC-15 started > > warning about these patterns. > > > > Move the index increment outside the accessor. > > > > Suggested-by: Andy Shevchenko > > Signed-off-by: Ingo Molnar > > Cc: Arnd Bergmann > > Cc: David Woodhouse > > Cc: H. Peter Anvin > > Cc: Kees Cook > > Cc: Linus Torvalds > > Cc: Mike Rapoport (Microsoft) > > --- > > arch/x86/kernel/e820.c | 6 ++++-- > > 1 file changed, 4 insertions(+), 2 deletions(-) > > > > diff --git a/arch/x86/kernel/e820.c b/arch/x86/kernel/e820.c > > index 10c6e7dc72d7..afb312620c82 100644 > > --- a/arch/x86/kernel/e820.c > > +++ b/arch/x86/kernel/e820.c > > @@ -421,9 +421,11 @@ __init int e820__update_table(struct e820_table *table) > > for (idx = 0; idx < table->nr_entries; idx++) { > > if (entries[idx].size != 0) { > nit: The level of nesting can easily be reduced by doing > if (entries[idx].size == 0) > continue; > > change_point[chg_idx]->addr = entries[idx].addr; > > - change_point[chg_idx++]->entry = &entries[idx]; > > + change_point[chg_idx]->entry = &entries[idx]; > > + chg_idx++; > > nit: I have to agree with H. Peter Anvin that this seems somewhat odd to me > as well. OK, I've dropped this change. Thanks, Ingo