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

Sean Anderson
2023-11-04T20:38:31Z

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

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

Changes in v2:
- Don't set load->priv for spl_nand_legacy_read since it doesn't use it.

common/spl/spl_nand.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/common/spl/spl_nand.c b/common/spl/spl_nand.c
index 07916bedbb9..5b6932bf7e0 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;
--
2.37.1