[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PULL 01/15] aspeed/smc: Fix possible integer overflow
From: |
Cédric Le Goater |
Subject: |
[PULL 01/15] aspeed/smc: Fix possible integer overflow |
Date: |
Sun, 21 Jul 2024 10:13:47 +0200 |
Coverity reports a possible integer overflow because routine
aspeeed_smc_hclk_divisor() has a codepath returning 0, which could
lead to an integer overflow when computing variable 'hclk_shift' in
the caller aspeed_smc_dma_calibration().
The value passed to aspeed_smc_hclk_divisor() is always between 0 and
15 and, in this case, there is always a matching hclk divisor. Remove
the return 0 and use g_assert_not_reached() instead.
Fixes: Coverity CID 1547822
Suggested-by: Peter Maydell <peter.maydell@linaro.org>
Signed-off-by: Cédric Le Goater <clg@redhat.com>
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
---
hw/ssi/aspeed_smc.c | 3 +--
1 file changed, 1 insertion(+), 2 deletions(-)
diff --git a/hw/ssi/aspeed_smc.c b/hw/ssi/aspeed_smc.c
index 49205ab76d38..f39fb85a35e9 100644
--- a/hw/ssi/aspeed_smc.c
+++ b/hw/ssi/aspeed_smc.c
@@ -789,8 +789,7 @@ static uint8_t aspeed_smc_hclk_divisor(uint8_t hclk_mask)
}
}
- aspeed_smc_error("invalid HCLK mask %x", hclk_mask);
- return 0;
+ g_assert_not_reached();
}
/*
--
2.45.2
- [PULL 00/15] aspeed queue, Cédric Le Goater, 2024/07/21
- [PULL 01/15] aspeed/smc: Fix possible integer overflow,
Cédric Le Goater <=
- [PULL 02/15] aspeed: Change type of eMMC device, Cédric Le Goater, 2024/07/21
- [PULL 03/15] aspeed: Load eMMC first boot area as a boot rom, Cédric Le Goater, 2024/07/21
- [PULL 05/15] aspeed: Introduce a AspeedSoCClass 'boot_from_emmc' handler, Cédric Le Goater, 2024/07/21
- [PULL 04/15] aspeed/scu: Add boot-from-eMMC HW strapping bit for AST2600 SoC, Cédric Le Goater, 2024/07/21
- [PULL 07/15] aspeed: Add boot-from-eMMC HW strapping bit to rainier-bmc machine, Cédric Le Goater, 2024/07/21
- [PULL 09/15] aspeed: Introduce a 'boot-emmc' machine option, Cédric Le Goater, 2024/07/21
- [PULL 06/15] aspeed: Tune eMMC device properties to reflect HW strapping, Cédric Le Goater, 2024/07/21
- [PULL 10/15] tests/avocado/machine_aspeed.py: Add eMMC boot tests, Cédric Le Goater, 2024/07/21
- [PULL 12/15] aspeed/soc: support ADC for AST2700, Cédric Le Goater, 2024/07/21
- [PULL 11/15] aspeed/adc: Add AST2700 support, Cédric Le Goater, 2024/07/21