hw/arm/smmuv3: Assert input to oas2bits() is valid
PATCH 1/1 hw/arm/smmuv3: Assert input to oas2bits() is valid
Coverity has spotted a possible problem with the OAS handling (CID 1558464), where the error return of oas2bits() -1 is not checked, which can cause an overflow in oas value.
oas2bits() is only called with valid inputs, harden the function to assert that.
--- hw/arm/smmuv3-internal.h | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
hw/arm/smmuv3-internal.h +2 -1
@@ -599,7 +599,8 @@ static inline int oas2bits(int oas_field)case 5 :return 48 ; } -return -1 ; + +g_assert_not_reached (); }/* CD fields */
Signature · 1 line
2.45.2.1089.g2a221341d9-goog
Quoted 7 lines · Mostafa Saleh
Coverity has spotted a possible problem with the OAS handling (CID 1558464), where the error return of
oas2bits()-1 is not checked, which can cause an overflow in oas value.
oas2bits()is only called with valid inputs, harden the function to assert that.
Quoted 6 lines
Reported-By Peter Maydell <[email protected]>Link https://lore.kernel.org/qemu-devel/CAFEAcA-H=n-3mHC+eL6YjfL1m+x+b+Fk3mkgZbN74WNxifFVow@mail.gmail.com/ open hereSigned-off-by Mostafa Saleh <[email protected]>--- hw/arm/smmuv3-internal.h | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
Quoted 10 lines · Mostafa Saleh
Coverity has spotted a possible problem with the OAS handling (CID 1558464), where the error return of
oas2bits()-1 is not checked, which can cause an overflow in oas value.
oas2bits()is only called with valid inputs, harden the function to assert that.
Eric
Quoted 18 lines
--- hw/arm/smmuv3-internal.h | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)hw/arm/smmuv3-internal.h +2
-1@@ -599,7 +599,8 @@ static inline int oas2bits(int oas_field)case 5 :return 48 ; } -return -1 ; + +g_assert_not_reached (); }/* CD fields */
Peter Maydell
AppliedQuoted 11 lines · Mostafa Saleh
Coverity has spotted a possible problem with the OAS handling (CID 1558464), where the error return of
oas2bits()-1 is not checked, which can cause an overflow in oas value.
oas2bits()is only called with valid inputs, harden the function to assert that.
Applied to target-arm.next, thanks.
-- PMM