[Devel] [PATCH RHEL7 COMMIT] venet: ipX_forward headroom check: uninit var fixup

Konstantin Khorenko khorenko at virtuozzo.com
Mon Jul 17 19:01:18 MSK 2017


The commit is pushed to "branch-rh7-3.10.0-514.26.1.vz7.33.x-ovz" and will appear at https://src.openvz.org/scm/ovz/vzkernel.git
after rh7-3.10.0-514.26.1.vz7.33.9
------>
commit 5ea4c9af81f7f85437de6b17849607991633fffe
Author: Konstantin Khorenko <khorenko at virtuozzo.com>
Date:   Mon Jul 17 19:56:39 2017 +0400

    venet: ipX_forward headroom check: uninit var fixup
    
    Fixing possible uninitialized variable usage:
    
    net/ipv4/ip_forward.c: In function 'ip_forward':
    net/ipv4/ip_forward.c:156:37: error: 'iph' may be used uninitialized in this function [-Werror=maybe-uninitialized]
     skb->priority = rt_tos2priority(iph->tos);
                                       ^
    Fixes: 9a05b36 ("venet: ipX_forward headroom check")
    
    https://jira.sw.ru/browse/PSBM-68362
    
    Signed-off-by: Konstantin Khorenko <khorenko at virtuozzo.com>
---
 net/ipv4/ip_forward.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/net/ipv4/ip_forward.c b/net/ipv4/ip_forward.c
index 556792c..3a1c2ff 100644
--- a/net/ipv4/ip_forward.c
+++ b/net/ipv4/ip_forward.c
@@ -132,8 +132,10 @@ int ip_forward(struct sk_buff *skb)
 	    (rt->rt_flags & RTCF_NAT) == 0 &&	  /* no NAT mangling expected */
 #endif						  /* and */
 	    (skb->dev->features & NETIF_F_VENET) && /* src is VENET device and */
-	    (skb_headroom(skb) >= hroom))	 /* skb has enough headroom */
+	    (skb_headroom(skb) >= hroom)) {	  /* skb has enough headroom */
+		iph = ip_hdr(skb);
 		goto no_ttl_decr;
+	}
 
 	/* We are about to mangle packet. Copy it! */
 	if (skb_cow(skb, hroom))


More information about the Devel mailing list