mirror of
https://mirrors.bfsu.edu.cn/git/linux.git
synced 2025-01-10 15:54:39 +08:00
smb: client: fix warning in generic_ip_connect()
This fixes the following warning reported by kernel test robot fs/smb/client/connect.c:2974 generic_ip_connect() error: we previously assumed 'socket' could be null (see line 2962) Link: https://lore.kernel.org/all/202306170124.CtQqzf0I-lkp@intel.com/ Signed-off-by: Paulo Alcantara (SUSE) <pc@manguebit.com> Signed-off-by: Steve French <stfrench@microsoft.com>
This commit is contained in:
parent
215533f888
commit
f0b6a834a8
@ -2934,11 +2934,11 @@ ip_rfc1001_connect(struct TCP_Server_Info *server)
|
||||
static int
|
||||
generic_ip_connect(struct TCP_Server_Info *server)
|
||||
{
|
||||
int rc = 0;
|
||||
__be16 sport;
|
||||
int slen, sfamily;
|
||||
struct socket *socket = server->ssocket;
|
||||
struct sockaddr *saddr;
|
||||
struct socket *socket;
|
||||
int slen, sfamily;
|
||||
__be16 sport;
|
||||
int rc = 0;
|
||||
|
||||
saddr = (struct sockaddr *) &server->dstaddr;
|
||||
|
||||
@ -2960,18 +2960,19 @@ generic_ip_connect(struct TCP_Server_Info *server)
|
||||
ntohs(sport));
|
||||
}
|
||||
|
||||
if (socket == NULL) {
|
||||
if (server->ssocket) {
|
||||
socket = server->ssocket;
|
||||
} else {
|
||||
rc = __sock_create(cifs_net_ns(server), sfamily, SOCK_STREAM,
|
||||
IPPROTO_TCP, &socket, 1);
|
||||
IPPROTO_TCP, &server->ssocket, 1);
|
||||
if (rc < 0) {
|
||||
cifs_server_dbg(VFS, "Error %d creating socket\n", rc);
|
||||
server->ssocket = NULL;
|
||||
return rc;
|
||||
}
|
||||
|
||||
/* BB other socket options to set KEEPALIVE, NODELAY? */
|
||||
cifs_dbg(FYI, "Socket created\n");
|
||||
server->ssocket = socket;
|
||||
socket = server->ssocket;
|
||||
socket->sk->sk_allocation = GFP_NOFS;
|
||||
socket->sk->sk_use_task_frag = false;
|
||||
if (sfamily == AF_INET6)
|
||||
|
Loading…
Reference in New Issue
Block a user