Aaron Durbin (adurbin@chromium.org) just uploaded a new patch set to gerrit, which you can find at https://review.coreboot.org/17714
-gerrit
commit dfa759d4709f3dc65dc74cd22a6799c087774518 Author: Aaron Durbin adurbin@chromium.org Date: Sat Dec 3 21:05:53 2016 -0600
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 --- src/include/ip_checksum.h | 2 +- src/lib/compute_ip_checksum.c | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-)
diff --git a/src/include/ip_checksum.h b/src/include/ip_checksum.h index a1e0ffa..f6ef560 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 58a6bf1..347b83f 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;