From mboxrd@z Thu Jan 1 00:00:00 1970 From: Vakul Garg Subject: [PATCH net-next] tls: Fixed uninitialised vars warning Date: Mon, 24 Sep 2018 16:09:49 +0530 Message-ID: <20180924103949.23822-1-vakul.garg@nxp.com> Mime-Version: 1.0 Content-Type: text/plain Cc: borisp@mellanox.com, aviadye@mellanox.com, davejwatson@fb.com, davem@davemloft.net, doronrk@fb.com, Vakul Garg To: netdev@vger.kernel.org Return-path: Received: from mail-eopbgr20088.outbound.protection.outlook.com ([40.107.2.88]:52160 "EHLO EUR02-VE1-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1726133AbeIXQmY (ORCPT ); Mon, 24 Sep 2018 12:42:24 -0400 Sender: netdev-owner@vger.kernel.org List-ID: In tls_sw_sendmsg() and tls_sw_sendpage(), it is possible that the uninitialised variable 'ret' gets passed to sk_stream_error(). So initialise local variable 'ret' to '0. The warnings were detected by 'smatch' tool. Fixes: a42055e8d2c3 ("net/tls: Add support for async encryption") Signed-off-by: Vakul Garg --- net/tls/tls_sw.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/net/tls/tls_sw.c b/net/tls/tls_sw.c index bcb24c498b84..102d84bdb2ab 100644 --- a/net/tls/tls_sw.c +++ b/net/tls/tls_sw.c @@ -709,7 +709,7 @@ int tls_sw_sendmsg(struct sock *sk, struct msghdr *msg, size_t size) int record_room; int num_zc = 0; int orig_size; - int ret; + int ret = 0; if (msg->msg_flags & ~(MSG_MORE | MSG_DONTWAIT | MSG_NOSIGNAL)) return -ENOTSUPP; @@ -901,8 +901,8 @@ int tls_sw_sendpage(struct sock *sk, struct page *page, int num_async = 0; bool full_record; int record_room; + int ret = 0; bool eor; - int ret; if (flags & ~(MSG_MORE | MSG_DONTWAIT | MSG_NOSIGNAL | MSG_SENDPAGE_NOTLAST)) -- 2.13.6