[U-Boot] [PATCH v2 1/4] fdtdec: protect against another NULL phandlep in fdtdec_add_reserved_memory()

Simon Glass sjg at chromium.org
Wed Oct 30 01:48:20 UTC 2019


On Tue, 22 Oct 2019 at 13:04, Heiko Stuebner <heiko at sntech.de> wrote:
>
> From: Heiko Stuebner <heiko.stuebner at theobroma-systems.com>
>
> The change adding fdtdec_add_reserved_memory() already protected the added
> phandle against the phandlep being NULL - making the phandlep var optional.
>
> But in the early code checking for an already existing carveout this check
> was not done and thus the phandle assignment could run into trouble,
> so add a check there as well, which makes the function still return
> successfully if a matching region is found, even though no-one wants to
> work with the phandle.
>
> Fixes: c9222a08b3f7 ("fdtdec: Implement fdtdec_add_reserved_memory()")
> Signed-off-by: Heiko Stuebner <heiko.stuebner at theobroma-systems.com>
> ---
> changes in v2:
> - add comment about phandlep allowed to be NULL
>
>  include/fdtdec.h | 1 +
>  lib/fdtdec.c     | 3 ++-
>  2 files changed, 3 insertions(+), 1 deletion(-)

Reviewed-by: Simon Glass <sjg at chromium.org>


More information about the U-Boot mailing list