From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-wm1-f73.google.com (mail-wm1-f73.google.com [209.85.128.73]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 25BE134D4F9 for ; Mon, 27 Apr 2026 15:35:41 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.128.73 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1777304143; cv=none; b=KymKpWNG7oQ1Z4t5K93kbbHA8vOkct0/8ocYzr3lYIe73mk7L51LPP+TH39sF359kWQKosQ3xtSc1S5pSFj+qFExTVyRMeM5ojEH/hGKPeU71Ht0CecgiZZRWJB150DRRvlFoJ43Qpse5V6PUqf66QczN5znxPGzALF8aah4Nqk= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1777304143; c=relaxed/simple; bh=iOBV/ragVWNZA9cpwk/m5In9oe0bnruniT9MVmdSMu4=; h=Date:In-Reply-To:Mime-Version:References:Message-ID:Subject:From: To:Cc:Content-Type; b=IBAjGh4/LS4v4qemQKaniCSF8Hs4FCwJwnvwSgAyePrdzRNyULFZiZGM/aNF7aU6hl7gZkMp6dwDSBy0WGbqzJriwRDdQQ01W8O6mTICIcwbAYXznAN2useleyZdC882ARaCNLCfPpxLwndL1lcDvc7ASbu+QKB3qjDkaRJbueg= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=google.com; spf=pass smtp.mailfrom=flex--ardb.bounces.google.com; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b=AZelkoK8; arc=none smtp.client-ip=209.85.128.73 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=google.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=flex--ardb.bounces.google.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b="AZelkoK8" Received: by mail-wm1-f73.google.com with SMTP id 5b1f17b1804b1-488f973ddfeso76715085e9.3 for ; Mon, 27 Apr 2026 08:35:40 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20251104; t=1777304139; x=1777908939; darn=vger.kernel.org; h=cc:to:from:subject:message-id:references:mime-version:in-reply-to :date:from:to:cc:subject:date:message-id:reply-to; bh=Fih3i4e18PfvVXsOqO+51UGmMLaCoh2lR+Igb4mepcc=; b=AZelkoK8lV4B6imC/9IdUO0WNNoVWz8A7iy1WwR8OPBjBRaf7qpBiAiGhRhKSJU/CR +7MfgYWJ0dr1RsQJJOsKpSthlG/8ygEV/xPiTscuTesFW2W7Zm2kxD5fLGpjB3C6ket7 A6bcKjMvWhpa5Wai25MmKUwuoc8ajl3Q2zWbdWiAha153RGh8E4r72kVkjUkqHf4fJPL qaruTFeSuhwliUd9OPSKSqdZq94IjAs9rbhVJ+cmpw3n9zKsL5N53Lx4MMiTn2cARAJu dvwzn+RpXrI1j+26SIySvpuggTKR02Hd1WDSQiD+RHRKr0fNOz3rZcYbSQsI1sGqoT6L usDA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1777304139; x=1777908939; h=cc:to:from:subject:message-id:references:mime-version:in-reply-to :date:x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=Fih3i4e18PfvVXsOqO+51UGmMLaCoh2lR+Igb4mepcc=; b=lCd0sYaBxY0tZEnvkaTmMnr3x/0BvKH1rhoB1LJhKXWEmuEIGwDRHuKInEMlN5BmIR o2Oc4wx49TdFUynALEOe+fRSprNUXmkTqnbkO3N31dFnKxuPOd4qxKie0vlOS8l0dOiF /DyQDTgaC/y5HH4ZXfNx8ZlOTmcH8uDTxHNyubd5Svzwyva1cFUsPFbyhEKLfyD4dgR1 jW9+OJ4M59TLsE0wN4EbQqKC4BtMCyyLPlD+Q+QfnYhlloBGnai+OhWUnwvlyOBqtRBV RXQdKXWQ/HCsrInj6im0hndGuCsWQlsrczFQjB1f/XRcE/d8sMdVDXBiHE7e1h9nqc2W ydmA== X-Gm-Message-State: AOJu0YwQvY7pHpl1sswNSKN0XyyJH+t1W4+N5SGSSGWcMHT/PUXheMW1 zBOfdbWfHP7SnNvAc6PUkpLhrhztsUOnCi7LHNFiG3d7lhDyodGkx8+kSRvbE3trrVTub2b8sw= = X-Received: from wmok24.prod.google.com ([2002:a05:600c:4798:b0:485:3a48:d6c5]) (user=ardb job=prod-delivery.src-stubby-dispatcher) by 2002:a05:600c:a30b:b0:487:4eb:d125 with SMTP id 5b1f17b1804b1-488fb74dff1mr437765065e9.9.1777304139320; Mon, 27 Apr 2026 08:35:39 -0700 (PDT) Date: Mon, 27 Apr 2026 17:34:22 +0200 In-Reply-To: <20260427153416.2103979-17-ardb+git@google.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: Mime-Version: 1.0 References: <20260427153416.2103979-17-ardb+git@google.com> X-Developer-Key: i=ardb@kernel.org; a=openpgp; fpr=F43D03328115A198C90016883D200E9CA6329909 X-Developer-Signature: v=1; a=openpgp-sha256; l=973; i=ardb@kernel.org; h=from:subject; bh=h7ZYPXsk7x8qiYN5Bb4ArPGJm788B+DXEeUwDjC4Hlg=; b=owGbwMvMwCVmkMcZplerG8N4Wi2JIfN9E2OMr//DSScOyewrtDKSTj2pNjs54uXG3/nW1/QLW jXW+t/rKGVhEONikBVTZBGY/ffdztMTpWqdZ8nCzGFlAhnCwMUpABPxecnwP+a5BK/ZucVOeU81 7jYvnbjm7Q/9FoVaDcW+23MP86w91sLwi+mK+4lU2YQl89dJGK4S/TllWwHHxeqs1PkRZyUC700 14gQA X-Mailer: git-send-email 2.54.0.rc2.544.gc7ae2d5bb8-goog Message-ID: <20260427153416.2103979-22-ardb+git@google.com> Subject: [PATCH v4 05/15] arm64: mm: Remove bogus stop condition from map_mem() loop From: Ard Biesheuvel To: linux-arm-kernel@lists.infradead.org Cc: linux-kernel@vger.kernel.org, will@kernel.org, catalin.marinas@arm.com, mark.rutland@arm.com, Ard Biesheuvel , Ryan Roberts , Anshuman Khandual , Liz Prucka , Seth Jenkins , Kees Cook , Mike Rapoport , David Hildenbrand , Andrew Morton , linux-mm@kvack.org, linux-hardening@vger.kernel.org Content-Type: text/plain; charset="UTF-8" From: Ard Biesheuvel The memblock API guarantees that start is not greater than or equal to end, so there is no need to test it. And if it were, it is doubtful that breaking out of the loop would be a reasonable course of action here (rather than attempting to map the remaining regions) So let's drop this check. Reviewed-by: Ryan Roberts Signed-off-by: Ard Biesheuvel --- arch/arm64/mm/mmu.c | 2 -- 1 file changed, 2 deletions(-) diff --git a/arch/arm64/mm/mmu.c b/arch/arm64/mm/mmu.c index 005844e521bd..bfbf3fe0d1be 100644 --- a/arch/arm64/mm/mmu.c +++ b/arch/arm64/mm/mmu.c @@ -1177,8 +1177,6 @@ static void __init map_mem(pgd_t *pgdp) /* map all the memory banks */ for_each_mem_range(i, &start, &end) { - if (start >= end) - break; /* * The linear map must allow allocation tags reading/writing * if MTE is present. Otherwise, it has the same attributes as -- 2.54.0.rc2.544.gc7ae2d5bb8-goog