2024-04-24 06:29:43

by Dan Carpenter

[permalink] [raw]
Subject: fs/smb/server/smb2pdu.c:1992 smb2_tree_connect() error: uninitialized symbol 'share'.

tree: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master
head: 9d1ddab261f3e2af7c384dc02238784ce0cf9f98
commit: e9d8c2f95ab8acaf3f4d4a53682a4afa3c263692 ksmbd: add continuous availability share parameter
config: x86_64-randconfig-161-20240424 (https://download.01.org/0day-ci/archive/20240424/[email protected]/config)
compiler: clang version 17.0.6 (https://github.com/llvm/llvm-project 6009708b4367171ccdbf4b5905cb6a803753fe18)

If you fix the issue in a separate patch/commit (i.e. not just a new version of
the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <[email protected]>
| Reported-by: Dan Carpenter <[email protected]>
| Closes: https://lore.kernel.org/r/[email protected]/

New smatch warnings:
fs/smb/server/smb2pdu.c:1992 smb2_tree_connect() error: uninitialized symbol 'share'.

vim +/share +1992 fs/smb/server/smb2pdu.c

e2f34481b24db2 fs/cifsd/smb2pdu.c Namjae Jeon 2021-03-16 1921 int smb2_tree_connect(struct ksmbd_work *work)
e2f34481b24db2 fs/cifsd/smb2pdu.c Namjae Jeon 2021-03-16 1922 {
e2f34481b24db2 fs/cifsd/smb2pdu.c Namjae Jeon 2021-03-16 1923 struct ksmbd_conn *conn = work->conn;
7b7d709ef7cf28 fs/smb/server/smb2pdu.c Namjae Jeon 2023-06-24 1924 struct smb2_tree_connect_req *req;
7b7d709ef7cf28 fs/smb/server/smb2pdu.c Namjae Jeon 2023-06-24 1925 struct smb2_tree_connect_rsp *rsp;
e2f34481b24db2 fs/cifsd/smb2pdu.c Namjae Jeon 2021-03-16 1926 struct ksmbd_session *sess = work->sess;
e2f34481b24db2 fs/cifsd/smb2pdu.c Namjae Jeon 2021-03-16 1927 char *treename = NULL, *name = NULL;
e2f34481b24db2 fs/cifsd/smb2pdu.c Namjae Jeon 2021-03-16 1928 struct ksmbd_tree_conn_status status;
e2f34481b24db2 fs/cifsd/smb2pdu.c Namjae Jeon 2021-03-16 1929 struct ksmbd_share_config *share;
e2f34481b24db2 fs/cifsd/smb2pdu.c Namjae Jeon 2021-03-16 1930 int rc = -EINVAL;
e2f34481b24db2 fs/cifsd/smb2pdu.c Namjae Jeon 2021-03-16 1931
7b7d709ef7cf28 fs/smb/server/smb2pdu.c Namjae Jeon 2023-06-24 1932 WORK_BUFFERS(work, req, rsp);
7b7d709ef7cf28 fs/smb/server/smb2pdu.c Namjae Jeon 2023-06-24 1933
c6cd2e8d2d9aa7 fs/smb/server/smb2pdu.c Namjae Jeon 2024-03-19 1934 treename = smb_strndup_from_utf16((char *)req + le16_to_cpu(req->PathOffset),
070fb21e5912b6 fs/cifsd/smb2pdu.c Namjae Jeon 2021-05-26 1935 le16_to_cpu(req->PathLength), true,
070fb21e5912b6 fs/cifsd/smb2pdu.c Namjae Jeon 2021-05-26 1936 conn->local_nls);
e2f34481b24db2 fs/cifsd/smb2pdu.c Namjae Jeon 2021-03-16 1937 if (IS_ERR(treename)) {
bde1694aecdb53 fs/cifsd/smb2pdu.c Namjae Jeon 2021-06-28 1938 pr_err("treename is NULL\n");
e2f34481b24db2 fs/cifsd/smb2pdu.c Namjae Jeon 2021-03-16 1939 status.ret = KSMBD_TREE_CONN_STATUS_ERROR;
e2f34481b24db2 fs/cifsd/smb2pdu.c Namjae Jeon 2021-03-16 1940 goto out_err1;
^^^^^^^^^^^^^

e2f34481b24db2 fs/cifsd/smb2pdu.c Namjae Jeon 2021-03-16 1941 }
e2f34481b24db2 fs/cifsd/smb2pdu.c Namjae Jeon 2021-03-16 1942
16b5f54e30c1dd fs/ksmbd/smb2pdu.c Atte Heikkil? 2022-09-15 1943 name = ksmbd_extract_sharename(conn->um, treename);
e2f34481b24db2 fs/cifsd/smb2pdu.c Namjae Jeon 2021-03-16 1944 if (IS_ERR(name)) {
e2f34481b24db2 fs/cifsd/smb2pdu.c Namjae Jeon 2021-03-16 1945 status.ret = KSMBD_TREE_CONN_STATUS_ERROR;
e2f34481b24db2 fs/cifsd/smb2pdu.c Namjae Jeon 2021-03-16 1946 goto out_err1;
^^^^^^^^^^^^^
e2f34481b24db2 fs/cifsd/smb2pdu.c Namjae Jeon 2021-03-16 1947 }
e2f34481b24db2 fs/cifsd/smb2pdu.c Namjae Jeon 2021-03-16 1948
e2f34481b24db2 fs/cifsd/smb2pdu.c Namjae Jeon 2021-03-16 1949 ksmbd_debug(SMB, "tree connect request for tree %s treename %s\n",
e2f34481b24db2 fs/cifsd/smb2pdu.c Namjae Jeon 2021-03-16 1950 name, treename);
e2f34481b24db2 fs/cifsd/smb2pdu.c Namjae Jeon 2021-03-16 1951
af7c39d971e43c fs/ksmbd/smb2pdu.c Namjae Jeon 2022-07-25 1952 status = ksmbd_tree_conn_connect(conn, sess, name);
e2f34481b24db2 fs/cifsd/smb2pdu.c Namjae Jeon 2021-03-16 1953 if (status.ret == KSMBD_TREE_CONN_STATUS_OK)
e2f34481b24db2 fs/cifsd/smb2pdu.c Namjae Jeon 2021-03-16 1954 rsp->hdr.Id.SyncId.TreeId = cpu_to_le32(status.tree_conn->id);
e2f34481b24db2 fs/cifsd/smb2pdu.c Namjae Jeon 2021-03-16 1955 else
e2f34481b24db2 fs/cifsd/smb2pdu.c Namjae Jeon 2021-03-16 1956 goto out_err1;

share is unitialized

e2f34481b24db2 fs/cifsd/smb2pdu.c Namjae Jeon 2021-03-16 1957
e2f34481b24db2 fs/cifsd/smb2pdu.c Namjae Jeon 2021-03-16 1958 share = status.tree_conn->share_conf;
e2f34481b24db2 fs/cifsd/smb2pdu.c Namjae Jeon 2021-03-16 1959 if (test_share_config_flag(share, KSMBD_SHARE_FLAG_PIPE)) {
e2f34481b24db2 fs/cifsd/smb2pdu.c Namjae Jeon 2021-03-16 1960 ksmbd_debug(SMB, "IPC share path request\n");
e2f34481b24db2 fs/cifsd/smb2pdu.c Namjae Jeon 2021-03-16 1961 rsp->ShareType = SMB2_SHARE_TYPE_PIPE;
e2f34481b24db2 fs/cifsd/smb2pdu.c Namjae Jeon 2021-03-16 1962 rsp->MaximalAccess = FILE_READ_DATA_LE | FILE_READ_EA_LE |
e2f34481b24db2 fs/cifsd/smb2pdu.c Namjae Jeon 2021-03-16 1963 FILE_EXECUTE_LE | FILE_READ_ATTRIBUTES_LE |
e2f34481b24db2 fs/cifsd/smb2pdu.c Namjae Jeon 2021-03-16 1964 FILE_DELETE_LE | FILE_READ_CONTROL_LE |
e2f34481b24db2 fs/cifsd/smb2pdu.c Namjae Jeon 2021-03-16 1965 FILE_WRITE_DAC_LE | FILE_WRITE_OWNER_LE |
e2f34481b24db2 fs/cifsd/smb2pdu.c Namjae Jeon 2021-03-16 1966 FILE_SYNCHRONIZE_LE;
e2f34481b24db2 fs/cifsd/smb2pdu.c Namjae Jeon 2021-03-16 1967 } else {
e2f34481b24db2 fs/cifsd/smb2pdu.c Namjae Jeon 2021-03-16 1968 rsp->ShareType = SMB2_SHARE_TYPE_DISK;
e2f34481b24db2 fs/cifsd/smb2pdu.c Namjae Jeon 2021-03-16 1969 rsp->MaximalAccess = FILE_READ_DATA_LE | FILE_READ_EA_LE |
e2f34481b24db2 fs/cifsd/smb2pdu.c Namjae Jeon 2021-03-16 1970 FILE_EXECUTE_LE | FILE_READ_ATTRIBUTES_LE;
e2f34481b24db2 fs/cifsd/smb2pdu.c Namjae Jeon 2021-03-16 1971 if (test_tree_conn_flag(status.tree_conn,
e2f34481b24db2 fs/cifsd/smb2pdu.c Namjae Jeon 2021-03-16 1972 KSMBD_TREE_CONN_FLAG_WRITABLE)) {
e2f34481b24db2 fs/cifsd/smb2pdu.c Namjae Jeon 2021-03-16 1973 rsp->MaximalAccess |= FILE_WRITE_DATA_LE |
e2f34481b24db2 fs/cifsd/smb2pdu.c Namjae Jeon 2021-03-16 1974 FILE_APPEND_DATA_LE | FILE_WRITE_EA_LE |
3aefd54da5ec6e fs/cifsd/smb2pdu.c Wan Jiabing 2021-06-07 1975 FILE_DELETE_LE | FILE_WRITE_ATTRIBUTES_LE |
3aefd54da5ec6e fs/cifsd/smb2pdu.c Wan Jiabing 2021-06-07 1976 FILE_DELETE_CHILD_LE | FILE_READ_CONTROL_LE |
3aefd54da5ec6e fs/cifsd/smb2pdu.c Wan Jiabing 2021-06-07 1977 FILE_WRITE_DAC_LE | FILE_WRITE_OWNER_LE |
3aefd54da5ec6e fs/cifsd/smb2pdu.c Wan Jiabing 2021-06-07 1978 FILE_SYNCHRONIZE_LE;
e2f34481b24db2 fs/cifsd/smb2pdu.c Namjae Jeon 2021-03-16 1979 }
e2f34481b24db2 fs/cifsd/smb2pdu.c Namjae Jeon 2021-03-16 1980 }
e2f34481b24db2 fs/cifsd/smb2pdu.c Namjae Jeon 2021-03-16 1981
e2f34481b24db2 fs/cifsd/smb2pdu.c Namjae Jeon 2021-03-16 1982 status.tree_conn->maximal_access = le32_to_cpu(rsp->MaximalAccess);
e2f34481b24db2 fs/cifsd/smb2pdu.c Namjae Jeon 2021-03-16 1983 if (conn->posix_ext_supported)
e2f34481b24db2 fs/cifsd/smb2pdu.c Namjae Jeon 2021-03-16 1984 status.tree_conn->posix_extensions = true;
e2f34481b24db2 fs/cifsd/smb2pdu.c Namjae Jeon 2021-03-16 1985
33b235a6e6ebe0 fs/smb/server/smb2pdu.c Namjae Jeon 2023-10-05 1986 write_lock(&sess->tree_conns_lock);
33b235a6e6ebe0 fs/smb/server/smb2pdu.c Namjae Jeon 2023-10-05 1987 status.tree_conn->t_state = TREE_CONNECTED;
33b235a6e6ebe0 fs/smb/server/smb2pdu.c Namjae Jeon 2023-10-05 1988 write_unlock(&sess->tree_conns_lock);
e2f34481b24db2 fs/cifsd/smb2pdu.c Namjae Jeon 2021-03-16 1989 rsp->StructureSize = cpu_to_le16(16);
cdfb2fef522d0c fs/ksmbd/smb2pdu.c Marios Makassikis 2022-12-23 1990 out_err1:
e9d8c2f95ab8ac fs/smb/server/smb2pdu.c Namjae Jeon 2024-04-20 1991 if (server_conf.flags & KSMBD_GLOBAL_FLAG_DURABLE_HANDLE &&
e9d8c2f95ab8ac fs/smb/server/smb2pdu.c Namjae Jeon 2024-04-20 @1992 test_share_config_flag(share,
^^^^^

e9d8c2f95ab8ac fs/smb/server/smb2pdu.c Namjae Jeon 2024-04-20 1993 KSMBD_SHARE_FLAG_CONTINUOUS_AVAILABILITY))
e9d8c2f95ab8ac fs/smb/server/smb2pdu.c Namjae Jeon 2024-04-20 1994 rsp->Capabilities = SMB2_SHARE_CAP_CONTINUOUS_AVAILABILITY;
e9d8c2f95ab8ac fs/smb/server/smb2pdu.c Namjae Jeon 2024-04-20 1995 else
e2f34481b24db2 fs/cifsd/smb2pdu.c Namjae Jeon 2021-03-16 1996 rsp->Capabilities = 0;
e2f34481b24db2 fs/cifsd/smb2pdu.c Namjae Jeon 2021-03-16 1997 rsp->Reserved = 0;
e2f34481b24db2 fs/cifsd/smb2pdu.c Namjae Jeon 2021-03-16 1998 /* default manual caching */
e2f34481b24db2 fs/cifsd/smb2pdu.c Namjae Jeon 2021-03-16 1999 rsp->ShareFlags = SMB2_SHAREFLAG_MANUAL_CACHING;
e2f34481b24db2 fs/cifsd/smb2pdu.c Namjae Jeon 2021-03-16 2000

--
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki



2024-04-24 07:23:54

by Namjae Jeon

[permalink] [raw]
Subject: Re: fs/smb/server/smb2pdu.c:1992 smb2_tree_connect() error: uninitialized symbol 'share'.

2024년 4월 24일 (수) 오후 3:28, Dan Carpenter <[email protected]>님이 작성:
Hi Dan,
>
> tree: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master
> head: 9d1ddab261f3e2af7c384dc02238784ce0cf9f98
> commit: e9d8c2f95ab8acaf3f4d4a53682a4afa3c263692 ksmbd: add continuous availability share parameter
> config: x86_64-randconfig-161-20240424 (https://download.01.org/0day-ci/archive/20240424/[email protected]/config)
> compiler: clang version 17.0.6 (https://github.com/llvm/llvm-project 6009708b4367171ccdbf4b5905cb6a803753fe18)
>
> If you fix the issue in a separate patch/commit (i.e. not just a new version of
> the same patch/commit), kindly add following tags
> | Reported-by: kernel test robot <[email protected]>
> | Reported-by: Dan Carpenter <[email protected]>
> | Closes: https://lore.kernel.org/r/[email protected]/
>
> New smatch warnings:
> fs/smb/server/smb2pdu.c:1992 smb2_tree_connect() error: uninitialized symbol 'share'.
I will fix it.
Thanks for your report.