]> git.itanic.dy.fi Git - linux-stable/commitdiff
net/handshake: Fix uninitialized local variable
authorChuck Lever <chuck.lever@oracle.com>
Thu, 11 May 2023 15:48:13 +0000 (11:48 -0400)
committerJakub Kicinski <kuba@kernel.org>
Thu, 25 May 2023 05:05:24 +0000 (22:05 -0700)
trace_handshake_cmd_done_err() simply records the pointer in @req,
so initializing it to NULL is sufficient and safe.

Reported-by: Dan Carpenter <dan.carpenter@linaro.org>
Fixes: 3b3009ea8abb ("net/handshake: Create a NETLINK service for handling handshake requests")
Reviewed-by: Simon Horman <simon.horman@corigine.com>
Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
net/handshake/netlink.c

index f5dc170689d9c99eee0530307fc4b690b9064e4c..16a4bde648bacf497649b62906e44ebd348c464f 100644 (file)
@@ -157,8 +157,8 @@ int handshake_nl_accept_doit(struct sk_buff *skb, struct genl_info *info)
 int handshake_nl_done_doit(struct sk_buff *skb, struct genl_info *info)
 {
        struct net *net = sock_net(skb->sk);
+       struct handshake_req *req = NULL;
        struct socket *sock = NULL;
-       struct handshake_req *req;
        int fd, status, err;
 
        if (GENL_REQ_ATTR_CHECK(info, HANDSHAKE_A_DONE_SOCKFD))