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>
This commit is contained in:
Aaron Durbin 2016-12-03 21:05:53 -06:00
parent 7c6951b059
commit 30c64be4ce
2 changed files with 3 additions and 3 deletions

View File

@ -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 */

View File

@ -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;