summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAaron Durbin <adurbin@chromium.org>2016-12-03 21:05:53 -0600
committerAaron Durbin <adurbin@chromium.org>2016-12-08 16:09:59 +0100
commit30c64be4ce1c3082c0dc0399ce0a5418698ad0cc (patch)
tree68c2460a5c99a9d7957f8da60cf57f601e9011b4
parent7c6951b059b9a7c36486a73f656ad8a88f648626 (diff)
lib/compute_ip_checksum: mark data buffer as const
compute_ip_checksum() doesn't manipulate the data it is passed. Therefore, mark it as const. BUG=chrome-os-partner:56151 Change-Id: I54cff9695a886bacd6314aa441d96aaa7a991101 Signed-off-by: Aaron Durbin <adurbin@chromium.org> Reviewed-on: https://review.coreboot.org/17714 Tested-by: build bot (Jenkins) Reviewed-by: Duncan Laurie <dlaurie@chromium.org> Reviewed-by: Furquan Shaikh <furquan@google.com> Reviewed-by: Paul Menzel <paulepanter@users.sourceforge.net>
-rw-r--r--src/include/ip_checksum.h2
-rw-r--r--src/lib/compute_ip_checksum.c4
2 files changed, 3 insertions, 3 deletions
diff --git a/src/include/ip_checksum.h b/src/include/ip_checksum.h
index a1e0ffabd1..f6ef560057 100644
--- a/src/include/ip_checksum.h
+++ b/src/include/ip_checksum.h
@@ -1,5 +1,5 @@
#ifndef IP_CHECKSUM_H
#define IP_CHECKSUM_H
-unsigned long compute_ip_checksum(void *addr, unsigned long length);
+unsigned long compute_ip_checksum(const void *addr, unsigned long length);
unsigned long add_ip_checksums(unsigned long offset, unsigned long sum, unsigned long new);
#endif /* IP_CHECKSUM_H */
diff --git a/src/lib/compute_ip_checksum.c b/src/lib/compute_ip_checksum.c
index 58a6bf1ee4..347b83f220 100644
--- a/src/lib/compute_ip_checksum.c
+++ b/src/lib/compute_ip_checksum.c
@@ -1,9 +1,9 @@
#include <stdint.h>
#include <ip_checksum.h>
-unsigned long compute_ip_checksum(void *addr, unsigned long length)
+unsigned long compute_ip_checksum(const void *addr, unsigned long length)
{
- uint8_t *ptr;
+ const uint8_t *ptr;
volatile union {
uint8_t byte[2];
uint16_t word;