[06/27] lib: fwts_safe_mem: add in missing constifications
diff mbox series

Message ID 20180815131129.24146-7-colin.king@canonical.com
State Accepted
Headers show
Series
  • [01/27] lib: fwts_framework: ensure src pointer is const
Related show

Commit Message

Colin Ian King Aug. 15, 2018, 1:11 p.m. UTC
From: Colin Ian King <colin.king@canonical.com>

The pointers are const, so ensure the pointer casting is const too.

Signed-off-by: Colin Ian King <colin.king@canonical.com>
---
 src/lib/src/fwts_safe_mem.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

Comments

Alex Hung Aug. 15, 2018, 5:55 p.m. UTC | #1
On 2018-08-15 06:11 AM, Colin King wrote:
> From: Colin Ian King <colin.king@canonical.com>
> 
> The pointers are const, so ensure the pointer casting is const too.
> 
> Signed-off-by: Colin Ian King <colin.king@canonical.com>
> ---
>   src/lib/src/fwts_safe_mem.c | 4 ++--
>   1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/src/lib/src/fwts_safe_mem.c b/src/lib/src/fwts_safe_mem.c
> index 10d4f7c5..a177a00b 100644
> --- a/src/lib/src/fwts_safe_mem.c
> +++ b/src/lib/src/fwts_safe_mem.c
> @@ -104,7 +104,7 @@ int OPTIMIZE0 fwts_safe_memread(const void *src, const size_t n)
>   int OPTIMIZE0 fwts_safe_memread32(const void *src, const size_t n)
>   {
>   	static uint32_t buffer[256];
> -	const uint32_t *ptr, *end = (uint32_t *)src + n;
> +	const uint32_t *ptr, *end = (const uint32_t *)src + n;
>   	uint32_t *bufptr;
>   	const uint32_t *bufend = buffer + (sizeof(buffer) / sizeof(*buffer));
>   
> @@ -139,7 +139,7 @@ int OPTIMIZE0 fwts_safe_memread32(const void *src, const size_t n)
>   int OPTIMIZE0 fwts_safe_memread64(const void *src, const size_t n)
>   {
>   	static uint64_t buffer[256];
> -	const uint64_t *ptr, *end = (uint64_t *)src + n;
> +	const uint64_t *ptr, *end = (const uint64_t *)src + n;
>   	uint64_t *bufptr;
>   	const uint64_t *bufend = buffer + (sizeof(buffer) / sizeof(*buffer));
>   
> 

Acked-by: Alex Hung <alex.hung@canonical.com>
Ivan Hu Aug. 16, 2018, 9:13 a.m. UTC | #2
On 08/15/2018 09:11 PM, Colin King wrote:
> From: Colin Ian King <colin.king@canonical.com>
>
> The pointers are const, so ensure the pointer casting is const too.
>
> Signed-off-by: Colin Ian King <colin.king@canonical.com>
> ---
>  src/lib/src/fwts_safe_mem.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/src/lib/src/fwts_safe_mem.c b/src/lib/src/fwts_safe_mem.c
> index 10d4f7c5..a177a00b 100644
> --- a/src/lib/src/fwts_safe_mem.c
> +++ b/src/lib/src/fwts_safe_mem.c
> @@ -104,7 +104,7 @@ int OPTIMIZE0 fwts_safe_memread(const void *src, const size_t n)
>  int OPTIMIZE0 fwts_safe_memread32(const void *src, const size_t n)
>  {
>  	static uint32_t buffer[256];
> -	const uint32_t *ptr, *end = (uint32_t *)src + n;
> +	const uint32_t *ptr, *end = (const uint32_t *)src + n;
>  	uint32_t *bufptr;
>  	const uint32_t *bufend = buffer + (sizeof(buffer) / sizeof(*buffer));
>  
> @@ -139,7 +139,7 @@ int OPTIMIZE0 fwts_safe_memread32(const void *src, const size_t n)
>  int OPTIMIZE0 fwts_safe_memread64(const void *src, const size_t n)
>  {
>  	static uint64_t buffer[256];
> -	const uint64_t *ptr, *end = (uint64_t *)src + n;
> +	const uint64_t *ptr, *end = (const uint64_t *)src + n;
>  	uint64_t *bufptr;
>  	const uint64_t *bufend = buffer + (sizeof(buffer) / sizeof(*buffer));
>  

Acked-by: Ivan Hu <ivan.hu@canonical.com>

Patch
diff mbox series

diff --git a/src/lib/src/fwts_safe_mem.c b/src/lib/src/fwts_safe_mem.c
index 10d4f7c5..a177a00b 100644
--- a/src/lib/src/fwts_safe_mem.c
+++ b/src/lib/src/fwts_safe_mem.c
@@ -104,7 +104,7 @@  int OPTIMIZE0 fwts_safe_memread(const void *src, const size_t n)
 int OPTIMIZE0 fwts_safe_memread32(const void *src, const size_t n)
 {
 	static uint32_t buffer[256];
-	const uint32_t *ptr, *end = (uint32_t *)src + n;
+	const uint32_t *ptr, *end = (const uint32_t *)src + n;
 	uint32_t *bufptr;
 	const uint32_t *bufend = buffer + (sizeof(buffer) / sizeof(*buffer));
 
@@ -139,7 +139,7 @@  int OPTIMIZE0 fwts_safe_memread32(const void *src, const size_t n)
 int OPTIMIZE0 fwts_safe_memread64(const void *src, const size_t n)
 {
 	static uint64_t buffer[256];
-	const uint64_t *ptr, *end = (uint64_t *)src + n;
+	const uint64_t *ptr, *end = (const uint64_t *)src + n;
 	uint64_t *bufptr;
 	const uint64_t *bufend = buffer + (sizeof(buffer) / sizeof(*buffer));