diff options
author | Patrick Delaunay <patrick.delaunay@foss.st.com> | 2023-04-27 15:36:34 +0200 |
---|---|---|
committer | Patrice Chotard <patrice.chotard@foss.st.com> | 2023-06-16 11:16:31 +0200 |
commit | 7b802e1acfc3a47e889afe22bdf47d1e52287cbe (patch) | |
tree | 67d5aa05aabddd5a400f3cc3bd3cf4206ef094f8 /arch/arm/mach-stm32mp | |
parent | 6bdef5b76757f192251d34e4c7330be9bf14f605 (diff) | |
download | u-boot-7b802e1acfc3a47e889afe22bdf47d1e52287cbe.zip u-boot-7b802e1acfc3a47e889afe22bdf47d1e52287cbe.tar.gz u-boot-7b802e1acfc3a47e889afe22bdf47d1e52287cbe.tar.bz2 |
stm32mp: bsec: add check on null size in misc ops
Add a protection in misc bsec ops for request with null size.
For example OP-TEE error occurs when get_eth_nb() return 0 in
setup_mac_address() for unknown part number because U-Boot read 0 OTPs.
Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>
Diffstat (limited to 'arch/arm/mach-stm32mp')
-rw-r--r-- | arch/arm/mach-stm32mp/bsec.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/arch/arm/mach-stm32mp/bsec.c b/arch/arm/mach-stm32mp/bsec.c index f5f4b20..0dc1e5c 100644 --- a/arch/arm/mach-stm32mp/bsec.c +++ b/arch/arm/mach-stm32mp/bsec.c @@ -622,7 +622,7 @@ static int stm32mp_bsec_read(struct udevice *dev, int offset, shadow = false; } - if ((offs % 4) || (size % 4)) + if ((offs % 4) || (size % 4) || !size) return -EINVAL; if (IS_ENABLED(CONFIG_OPTEE) && priv->tee) { @@ -678,7 +678,7 @@ static int stm32mp_bsec_write(struct udevice *dev, int offset, shadow = false; } - if ((offs % 4) || (size % 4)) + if ((offs % 4) || (size % 4) || !size) return -EINVAL; if (IS_ENABLED(CONFIG_OPTEE) && priv->tee) { |