[Devel] [PATCH RHEL7 COMMIT] ve/net/packet: fix possible return of uninitialized var

Konstantin Khorenko khorenko at virtuozzo.com
Wed Jul 29 07:43:29 PDT 2015


The commit is pushed to "branch-rh7-3.10.0-229.7.2-ovz" and will appear at https://src.openvz.org/scm/ovz/vzkernel.git
after rh7-3.10.0-229.7.2.el7
------>
commit b833104ada494a6b2643be918e2cb39c31f9506d
Author: Konstantin Khorenko <khorenko at virtuozzo.com>
Date:   Wed Jul 29 18:34:44 2015 +0400

    ve/net/packet: fix possible return of uninitialized var
    
    net/packet/af_packet.c: In function ‘packet_create’:
    net/packet/af_packet.c:2762:6: error: ‘err’ may be used uninitialized in this function [-Werror=maybe-uninitialized]
      int err;
          ^
    
    This is fix for
    b3b3c0a net/packet: Pre-account maximum socket buffer into cg memory (v3)
    
    Signed-off-by: Konstantin Khorenko <khorenko at virtuozzo.com>
---
 net/packet/af_packet.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/net/packet/af_packet.c b/net/packet/af_packet.c
index b1146d3..ee9d56b 100644
--- a/net/packet/af_packet.c
+++ b/net/packet/af_packet.c
@@ -2769,8 +2769,10 @@ static int packet_create(struct net *net, struct socket *sock, int protocol,
 
 	sock->state = SS_UNCONNECTED;
 	cg = packet_sk_charge();
-	if (IS_ERR(cg))
+	if (IS_ERR(cg)) {
+		err = PTR_ERR(cg);
 		goto out;
+	}
 
 	err = -ENOBUFS;
 	sk = sk_alloc(net, PF_PACKET, GFP_KERNEL, &packet_proto);



More information about the Devel mailing list