mirror of
https://source.denx.de/u-boot/u-boot.git
synced 2026-06-13 15:03:58 +03:00
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>
This commit is contained in:
committed by
Patrice Chotard
parent
6bdef5b767
commit
7b802e1acf
@@ -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) {
|
||||
|
||||
Reference in New Issue
Block a user