Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 8cb7b772 authored by qctecmdr's avatar qctecmdr Committed by Gerrit - the friendly Code Review server
Browse files

Merge "diag: Allocate mask update buffer using vzalloc"

parents 8e001eb1 682b573b
Loading
Loading
Loading
Loading
+7 −8
Original line number Diff line number Diff line
/* Copyright (c) 2008-2019, The Linux Foundation. All rights reserved.
/* Copyright (c) 2008-2020, The Linux Foundation. All rights reserved.
 *
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License version 2 and
@@ -1021,7 +1021,7 @@ static int diag_cmd_set_all_msg_mask(unsigned char *src_buf, int src_len,
			info = diag_md_session_get_peripheral(DIAG_LOCAL_PROC,
								APPS_DATA);
			ret_val = diag_save_user_msg_mask(info);
			if (ret_val)
			if (ret_val < 0)
				pr_err("diag: unable to save msg mask to update userspace clients err:%d\n",
					ret_val);
			mutex_unlock(&driver->md_session_lock);
@@ -1833,8 +1833,7 @@ static int __diag_mask_init(struct diag_mask_info *mask_info, int mask_len,
			return -ENOMEM;
		}
		kmemleak_not_leak(mask_info->update_buf);
		mask_info->update_buf_client = kzalloc(MAX_USERSPACE_BUF_SIZ,
							GFP_KERNEL);
		mask_info->update_buf_client = vzalloc(MAX_USERSPACE_BUF_SIZ);
		if (!mask_info->update_buf_client) {
			kfree(mask_info->update_buf);
			mask_info->update_buf = NULL;
@@ -1842,7 +1841,6 @@ static int __diag_mask_init(struct diag_mask_info *mask_info, int mask_len,
			mask_info->ptr = NULL;
			return -ENOMEM;
		}
		kmemleak_not_leak(mask_info->update_buf_client);
		mask_info->update_buf_client_len = 0;
	}
	return 0;
@@ -1858,7 +1856,7 @@ static void __diag_mask_exit(struct diag_mask_info *mask_info)
	mask_info->ptr = NULL;
	kfree(mask_info->update_buf);
	mask_info->update_buf = NULL;
	kfree(mask_info->update_buf_client);
	vfree(mask_info->update_buf_client);
	mask_info->update_buf_client = NULL;
	mutex_unlock(&mask_info->lock);
}
@@ -2056,7 +2054,7 @@ static void diag_msg_mask_exit(void)
	}
	kfree(msg_mask.update_buf);
	msg_mask.update_buf = NULL;
	kfree(msg_mask.update_buf_client);
	vfree(msg_mask.update_buf_client);
	msg_mask.update_buf_client = NULL;
	mutex_unlock(&driver->msg_mask_lock);
}
@@ -2136,7 +2134,7 @@ static void diag_log_mask_exit(void)
	}

	kfree(log_mask.update_buf);
	kfree(log_mask.update_buf_client);
	vfree(log_mask.update_buf_client);
	log_mask.update_buf_client = NULL;
}

@@ -2192,6 +2190,7 @@ static void diag_event_mask_exit(void)
{
	kfree(event_mask.ptr);
	kfree(event_mask.update_buf);
	vfree(event_mask.update_buf_client);
}

int diag_copy_to_user_msg_mask(char __user *buf, size_t count,