[PATCH 01/15] spl: nand: Fix NULL-pointer dereference

Sean Anderson
2023-10-29T03:49:18Z

spl_nand_fit_read unconditionally accesses load->priv. Ensure it is set.

Fixes: 00e180cc513 ("spl: nand: support loading i.MX container format file")
Fixes: 4620e8aabc1 ("spl: nand: support loading legacy image with payload compressed")
Signed-off-by: Sean Anderson <seanga2@gmail.com>
---

common/spl/spl_nand.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/common/spl/spl_nand.c b/common/spl/spl_nand.c
index 07916bedbb9..a19236d9e6d 100644
--- a/common/spl/spl_nand.c
+++ b/common/spl/spl_nand.c
@@ -105,7 +105,7 @@ static int spl_nand_load_element(struct spl_image_info *spl_image,
struct spl_load_info load;

load.dev = NULL;
- load.priv = NULL;
+ load.priv = &offset;
load.filename = NULL;
load.bl_len = bl_len;
load.read = spl_nand_fit_read;
@@ -116,7 +116,7 @@ static int spl_nand_load_element(struct spl_image_info *spl_image,

debug("Found legacy image\n");
load.dev = NULL;
- load.priv = NULL;
+ load.priv = &offset;
load.filename = NULL;
load.bl_len = 1;
load.read = spl_nand_legacy_read;
--
2.37.1