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:
parent
7c6951b059
commit
30c64be4ce
|
@ -1,5 +1,5 @@
|
||||||
#ifndef IP_CHECKSUM_H
|
#ifndef IP_CHECKSUM_H
|
||||||
#define 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);
|
unsigned long add_ip_checksums(unsigned long offset, unsigned long sum, unsigned long new);
|
||||||
#endif /* IP_CHECKSUM_H */
|
#endif /* IP_CHECKSUM_H */
|
||||||
|
|
|
@ -1,9 +1,9 @@
|
||||||
#include <stdint.h>
|
#include <stdint.h>
|
||||||
#include <ip_checksum.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 {
|
volatile union {
|
||||||
uint8_t byte[2];
|
uint8_t byte[2];
|
||||||
uint16_t word;
|
uint16_t word;
|
||||||
|
|
Loading…
Reference in New Issue