[ovs-dev] [PATCH 6/7] packets: Fix null pointer dereference reported by clang.
William Tu
u9012063 at gmail.com
Wed Jun 29 05:02:27 UTC 2016
In packet_set_tcp_port(), clang reports passing null pointer of &th->tcp_src
when calling packet_set_port(&th->tcp_src, src, &th->tcp_csum);
Signed-off-by: William Tu <u9012063 at gmail.com>
---
lib/packets.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/lib/packets.c b/lib/packets.c
index 43b5a70..1d3f409 100644
--- a/lib/packets.c
+++ b/lib/packets.c
@@ -1036,7 +1036,7 @@ packet_set_ipv6(struct dp_packet *packet, const ovs_be32 src[4],
static void
packet_set_port(ovs_be16 *port, ovs_be16 new_port, ovs_be16 *csum)
{
- if (*port != new_port) {
+ if (port && *port != new_port) {
*csum = recalc_csum16(*csum, *port, new_port);
*port = new_port;
}
--
2.5.0
More information about the dev
mailing list