diff options
author | Alexey Kardashevskiy <aik@ozlabs.ru> | 2021-01-27 19:37:21 +1100 |
---|---|---|
committer | Alexey Kardashevskiy <aik@ozlabs.ru> | 2021-02-12 13:46:16 +1100 |
commit | e244301a3192c91ceed8daf8c03afa1c88328e7e (patch) | |
tree | 1ed3e2eeecaab86039bb3252419f2a0151283fc1 | |
parent | c79e3375e606c666bda71a840d2afb932bd2813b (diff) | |
download | SLOF-e244301a3192c91ceed8daf8c03afa1c88328e7e.zip SLOF-e244301a3192c91ceed8daf8c03afa1c88328e7e.tar.gz SLOF-e244301a3192c91ceed8daf8c03afa1c88328e7e.tar.bz2 |
e1000: Compile with -Wextra
-Wextra enables a bunch of rather useful checks which this fixes.
Signed-off-by: Alexey Kardashevskiy <aik@ozlabs.ru>
-rw-r--r-- | lib/libe1k/e1k.c | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/lib/libe1k/e1k.c b/lib/libe1k/e1k.c index 4dd7d2e..3bbc75f 100644 --- a/lib/libe1k/e1k.c +++ b/lib/libe1k/e1k.c @@ -163,7 +163,7 @@ static const e1k_dev_t e1k_dev[] = { { 0x1016, E1K_82540, "82540EP Mobile" }, { 0x1017, E1K_82540, "82540EP Desktop" }, { 0x100E, E1K_82540, "82540EM Desktop" }, - { 0 , 0 } + { 0 } }; /* @@ -182,8 +182,8 @@ check_driver(uint16_t vendor_id, uint16_t device_id); static int e1k_init(net_driver_t *driver); static int e1k_term(void); -static int e1k_xmit(char *f_buffer_pc, int f_len_i); -static int e1k_receive(char *f_buffer_pc, int f_len_i); +static int e1k_xmit(char *f_buffer_pc, unsigned f_len_i); +static int e1k_receive(char *f_buffer_pc, unsigned f_len_i); /** * Translate virtual to "physical" address, ie. an address @@ -549,11 +549,11 @@ e1k_mac_init(uint8_t *f_mac_pu08) * e1k_receive */ static int -e1k_receive(char *f_buffer_pc, int f_len_i) +e1k_receive(char *f_buffer_pc, unsigned f_len_i) { uint32_t l_rdh_u32 = e1k_rd32(RDH); // this includes needed dummy read e1k_rx_desc_st *rx; - int l_ret_i; + unsigned l_ret_i; #ifdef E1K_DEBUG #ifdef E1K_SHOW_RCV_DATA @@ -589,11 +589,11 @@ e1k_receive(char *f_buffer_pc, int f_len_i) * copy the data */ memcpy((uint8_t *) f_buffer_pc, dma2virt(bswap_64(rx->m_buffer_u64)), - (size_t) l_ret_i); + (size_t) MIN(l_ret_i, f_len_i)); #ifdef E1K_DEBUG #if defined(E1K_SHOW_RCV) || defined(E1K_SHOW_RCV_DATA) - printf("e1k: %d bytes received\n", l_ret_i); + printf("e1k: %d bytes received (max %d)\n", l_ret_i, f_len_i); #endif #ifdef E1K_SHOW_RCV_DATA @@ -631,7 +631,7 @@ e1k_receive(char *f_buffer_pc, int f_len_i) } static int -e1k_xmit(char *f_buffer_pc, int f_len_i) +e1k_xmit(char *f_buffer_pc, unsigned f_len_i) { uint32_t l_tdh_u32 = e1k_rd32(TDH); uint32_t l_tdt_u32 = e1k_rd32(TDT); |