tcp: Silence warning from gcc 11.3 with -Ofast
If the first packet_get() call doesn't assign len, the second one will also return NULL, but gcc doesn't see this. Signed-off-by: Stefano Brivio <sbrivio@redhat.com>
This commit is contained in:
parent
fb59cfc909
commit
deda03bfc2
2 changed files with 10 additions and 4 deletions
4
packet.h
4
packet.h
|
@ -40,10 +40,10 @@ void *packet_get_do(const struct pool *p, const size_t index,
|
||||||
void pool_flush(struct pool *p);
|
void pool_flush(struct pool *p);
|
||||||
|
|
||||||
#define packet_add(p, len, start) \
|
#define packet_add(p, len, start) \
|
||||||
packet_add_do(p, len, start, __func__, __LINE__);
|
packet_add_do(p, len, start, __func__, __LINE__)
|
||||||
|
|
||||||
#define packet_get(p, index, offset, len, left) \
|
#define packet_get(p, index, offset, len, left) \
|
||||||
packet_get_do(p, index, offset, len, left, __func__, __LINE__);
|
packet_get_do(p, index, offset, len, left, __func__, __LINE__)
|
||||||
|
|
||||||
#define packet_get_try(p, index, offset, len, left) \
|
#define packet_get_try(p, index, offset, len, left) \
|
||||||
packet_get_do(p, index, offset, len, left, NULL, 0)
|
packet_get_do(p, index, offset, len, left, NULL, 0)
|
||||||
|
|
10
tcp.c
10
tcp.c
|
@ -2505,7 +2505,11 @@ static void tcp_data_from_tap(struct ctx *c, struct tcp_conn *conn,
|
||||||
char *data;
|
char *data;
|
||||||
size_t off;
|
size_t off;
|
||||||
|
|
||||||
packet_get(p, i, 0, 0, &len);
|
if (!packet_get(p, i, 0, 0, &len)) {
|
||||||
|
tcp_rst(c, conn);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
th = packet_get(p, i, 0, sizeof(*th), NULL);
|
th = packet_get(p, i, 0, sizeof(*th), NULL);
|
||||||
if (!th) {
|
if (!th) {
|
||||||
tcp_rst(c, conn);
|
tcp_rst(c, conn);
|
||||||
|
@ -2729,7 +2733,9 @@ int tcp_tap_handler(struct ctx *c, int af, const void *addr,
|
||||||
int ack_due = 0;
|
int ack_due = 0;
|
||||||
char *opts;
|
char *opts;
|
||||||
|
|
||||||
packet_get(p, 0, 0, 0, &len);
|
if (!packet_get(p, 0, 0, 0, &len))
|
||||||
|
return 1;
|
||||||
|
|
||||||
th = packet_get(p, 0, 0, sizeof(*th), NULL);
|
th = packet_get(p, 0, 0, sizeof(*th), NULL);
|
||||||
if (!th)
|
if (!th)
|
||||||
return 1;
|
return 1;
|
||||||
|
|
Loading…
Reference in a new issue