NAND reads are done on a per-page basis. Scenarios that attempt to read less than a page will find their memory has been clobbered by the NAND read.
Allocate a buffer for the NAND page, and only overwrite the memory that the user requested. This is a continuation of [1], since there is now a cover letter and multiple patches. [1] (https://lists.denx.de/pipermail/u-boot/2022-November/499862.html) v2: Add cover letter Add Dario reviewed to patch 2 Add patch 1 to move the buffer to the heap Add my own apologies for taking me so incredibly long to fix this patch up and resubmit. Colin Foster (2): mtd: rawnand: nand_spl_loaders: move nand page buffer to heap mtd: rawnand: nand_spl_loaders: allow partial nand page reads during nand_spl_load_image drivers/mtd/nand/raw/nand_spl_loaders.c | 46 ++++++++++++++++++------- 1 file changed, 34 insertions(+), 12 deletions(-) -- 2.25.1