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

Submitted by Konstantin Khorenko on July 17, 2017, 4:01 p.m.

Details

Message ID 201707171601.v6HG1IXL023774@finist_cl7.x64_64.work.ct
State New
Series "venet: ipX_forward headroom check"
Headers show

Commit Message

Konstantin Khorenko July 17, 2017, 4:01 p.m.
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@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@virtuozzo.com>
---
 net/ipv4/ip_forward.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

Patch hide | download patch | download mbox

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))