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 7103D3914E0 for ; Fri, 3 Apr 2026 11:21:22 +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=1775215282; cv=none; b=e+VRcMvwmh//Pye+/gSDSqJmeI9SgnFSl+uN8C3TZmZsVAK8H5mLazcuiCZX1ybo3VQLEn2niqUpLY7CwB0Yt4/SkUErZsfW2jwAV+INSDs2zpyNtLxRdRYP6/Au0mCNdtKjL1hbrFptSMj32PRfXYrdbYfDPkgES3WQ2oiwWxs= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1775215282; c=relaxed/simple; bh=C2PE0QSFewGyAGB7w24PL7F8mQ26TmpseXExWlTHEWY=; h=From:To:Cc:Subject:In-Reply-To:References:Date:Message-ID: MIME-Version:Content-Type; b=hqqcWTXXUCQmacG5++pECtjq+/jjZ9x62t6eLt5rpFvfDY4oTQojQLG11pwbED4+k+sjzPEYHHlYDdFUbVwTSeHfkBnfpQVnMK2avjj/jwmFKrcr1u4uXrTuDj4xCAw4l2t/SOny+UW+pKMqReJD1F0h2Zc/Kj+d7aDmTrv15hk= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=KnOMtt0Y; 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="KnOMtt0Y" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 27C78C4CEF7; Fri, 3 Apr 2026 11:21:18 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1775215281; bh=C2PE0QSFewGyAGB7w24PL7F8mQ26TmpseXExWlTHEWY=; h=From:To:Cc:Subject:In-Reply-To:References:Date:From; b=KnOMtt0Y7qhdjpMeGPoOcoZzqzzIQ8bv9ED6tBakBnpMTCVr5t/aZUH/yShW+kwBO /E2OZ019G6iRF3IQ792ESCtxHs8GPQZBq562VKyr4/bxj2976VMZNZ07swz+bUe1Qa ZtzRE2+6UfFy+gOhX20mXNwcHni8iH0Rejl0Cs2vUZZx5gnYtDdLPdfLmtmJ69IyMs N2PwyydrgIkOPhcG/BkRqLSiTDjIATePGlYEMu1bajcReeOZmit3q3LXmhAo09TpHW d1MH+pIx1nfc5NNBB+Rm2S97U8CFTy3i+QuA1YH3xdXmB2cfpux78gF0vPlJMVL9yN a5wtgMCfecICQ== From: Pratyush Yadav To: Breno Leitao Cc: Alexander Graf , Mike Rapoport , Pasha Tatashin , Pratyush Yadav , linux-kernel@vger.kernel.org, kexec@lists.infradead.org, linux-mm@kvack.org, usama.arif@linux.dev, SeongJae Park , kernel-team@meta.com Subject: Re: [PATCH v9 1/6] kho: add size parameter to kho_add_subtree() In-Reply-To: <20260316-kho-v9-1-ed6dcd951988@debian.org> (Breno Leitao's message of "Mon, 16 Mar 2026 04:54:31 -0700") References: <20260316-kho-v9-0-ed6dcd951988@debian.org> <20260316-kho-v9-1-ed6dcd951988@debian.org> Date: Fri, 03 Apr 2026 11:21:17 +0000 Message-ID: <2vxz1pgwe1ci.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 Mon, Mar 16 2026, Breno Leitao wrote: > kho_add_subtree() assumes the fdt argument is always an FDT and calls > fdt_totalsize() on it in the debugfs code path. This assumption will > break if a caller passes arbitrary data instead of an FDT. > > When CONFIG_KEXEC_HANDOVER_DEBUGFS is enabled, kho_debugfs_fdt_add() > calls __kho_debugfs_fdt_add(), which executes: > > f->wrapper.size = fdt_totalsize(fdt); > > Fix this by adding an explicit size parameter to kho_add_subtree() so > callers specify the blob size. This allows subtrees to contain > arbitrary data formats, not just FDTs. Update all callers: > > - memblock.c: use fdt_totalsize(fdt) > - luo_core.c: use fdt_totalsize(fdt_out) > - test_kho.c: use fdt_totalsize() > - kexec_handover.c (root fdt): use fdt_totalsize(kho_out.fdt) > > Also update __kho_debugfs_fdt_add() to receive the size explicitly > instead of computing it internally via fdt_totalsize(). In > kho_in_debugfs_init(), pass fdt_totalsize() for the root FDT and > sub-blobs since all current users are FDTs. A subsequent patch will > persist the size in the KHO FDT so the incoming side can handle > non-FDT blobs correctly. > > Suggested-by: Pratyush Yadav > Reviewed-by: Mike Rapoport (Microsoft) > Signed-off-by: Breno Leitao Reviewed-by: Pratyush Yadav [...] -- Regards, Pratyush Yadav