Just use kmalloc() for small allocations.
Signed-off-by: Namjae Jeon <namjae.jeon@samsung.com>
Signed-off-by: Steve French <stfrench@microsoft.com>
{
struct wm_list *l, *nl;
- nl = kvmalloc(sizeof(struct wm_list), GFP_KERNEL);
+ nl = kmalloc(sizeof(struct wm_list), GFP_KERNEL);
if (!nl)
return -ENOMEM;
while (veto_list_sz > 0) {
struct ksmbd_veto_pattern *p;
- p = ksmbd_alloc(sizeof(struct ksmbd_veto_pattern));
+ p = kzalloc(sizeof(struct ksmbd_veto_pattern), GFP_KERNEL);
if (!p)
return -ENOMEM;
if (resp->flags == KSMBD_SHARE_FLAG_INVALID)
goto out;
- share = ksmbd_alloc(sizeof(struct ksmbd_share_config));
+ share = kzalloc(sizeof(struct ksmbd_share_config), GFP_KERNEL);
if (!share)
goto out;
{
struct ksmbd_user *user = NULL;
- user = ksmbd_alloc(sizeof(struct ksmbd_user));
+ user = kmalloc(sizeof(struct ksmbd_user), GFP_KERNEL);
if (!user)
return NULL;
user->gid = resp->gid;
user->uid = resp->uid;
user->passkey_sz = resp->hash_sz;
- user->passkey = ksmbd_alloc(resp->hash_sz);
+ user->passkey = kmalloc(resp->hash_sz, GFP_KERNEL);
if (user->passkey)
memcpy(user->passkey, resp->hash, resp->hash_sz);
if (!method)
return -EINVAL;
- entry = ksmbd_alloc(sizeof(struct ksmbd_session_rpc));
+ entry = kzalloc(sizeof(struct ksmbd_session_rpc), GFP_KERNEL);
if (!entry)
return -EINVAL;
struct ksmbd_session *sess;
int ret;
- sess = ksmbd_alloc(sizeof(struct ksmbd_session));
+ sess = kzalloc(sizeof(struct ksmbd_session), GFP_KERNEL);
if (!sess)
return NULL;
static inline int allocate_oplock_break_buf(struct ksmbd_work *work)
{
- work->response_buf = ksmbd_alloc_response(MAX_CIFS_SMALL_BUFFER_SIZE);
+ work->response_buf = kzalloc(MAX_CIFS_SMALL_BUFFER_SIZE, GFP_KERNEL);
if (!work->response_buf)
return -ENOMEM;
work->response_sz = MAX_CIFS_SMALL_BUFFER_SIZE;
if (sess->Preauth_HashValue)
return 0;
- sess->Preauth_HashValue = ksmbd_alloc(PREAUTH_HASHVALUE_SIZE);
+ sess->Preauth_HashValue = kmalloc(PREAUTH_HASHVALUE_SIZE, GFP_KERNEL);
if (!sess->Preauth_HashValue)
return -ENOMEM;
if (ARRAY_SIZE(iov) < rq_nvec)
return -ENOMEM;
- tr_hdr = ksmbd_alloc_response(sizeof(struct smb2_transform_hdr));
+ tr_hdr = kzalloc(sizeof(struct smb2_transform_hdr), GFP_KERNEL);
if (!tr_hdr)
return rc;
if (!ifname)
return NULL;
- iface = ksmbd_alloc(sizeof(struct interface));
+ iface = kzalloc(sizeof(struct interface), GFP_KERNEL);
if (!iface) {
kfree(ifname);
return NULL;
int ksmbd_init_file_table(struct ksmbd_file_table *ft)
{
- ft->idr = ksmbd_alloc(sizeof(struct idr));
+ ft->idr = kzalloc(sizeof(struct idr), GFP_KERNEL);
if (!ft->idr)
return -ENOMEM;