From 0b495b234cc2f89b0e196a7128a269bf7da0e81e Mon Sep 17 00:00:00 2001 From: Ari Sundholm Date: Fri, 6 Nov 2020 14:45:02 +0200 Subject: [PATCH] altera_epcq_controller_mod.c: Fix faulty read/write end address check. In the Flash info structure, the field containing the end address of the Flash storage is documented to be non-inclusive. However, when this field is compared to the end address of a read or write, which is also non-inclusive, it is considered an error that these two values match, which is incorrect, as this would error out on an attempt to fully read/write the last page. Fix this by simply changing the >= comparison into a > one. --- .../HAL/src/altera_epcq_controller_mod.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ip/altera_epcq_controller_mod/HAL/src/altera_epcq_controller_mod.c b/ip/altera_epcq_controller_mod/HAL/src/altera_epcq_controller_mod.c index 35c7c10..3c096d1 100644 --- a/ip/altera_epcq_controller_mod/HAL/src/altera_epcq_controller_mod.c +++ b/ip/altera_epcq_controller_mod/HAL/src/altera_epcq_controller_mod.c @@ -736,7 +736,7 @@ ALT_INLINE alt_32 static alt_epcq_validate_read_write_arguments /* make sure start and end address is less then the end address of the flash */ if( start_address >= epcq_flash_info->data_end || - end_address >= epcq_flash_info->data_end || + end_address > epcq_flash_info->data_end || offset < 0 || length < 0 )