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

Commit 6095db3f authored by Xiaoyu Ye's avatar Xiaoyu Ye Committed by Gerrit - the friendly Code Review server
Browse files

ASoC: wcd934x-dsp-cntl: initialize local char array val



Due to the local char array that stores the codec dsp control command
is not initialized, an invalid command could cause the stack content
to be printed out in kernel dmesg. Initialize the array with memset.

Change-Id: I739eacb5058275c91bef67505531097cb364b93e
Signed-off-by: default avatarXiaoyu Ye <benyxy@codeaurora.org>
parent 2e628184
Loading
Loading
Loading
Loading
+3 −1
Original line number Original line Diff line number Diff line
@@ -1011,10 +1011,12 @@ static ssize_t wcd_miscdev_write(struct file *filep, const char __user *ubuf,
{
{
	struct wcd_dsp_cntl *cntl = container_of(filep->private_data,
	struct wcd_dsp_cntl *cntl = container_of(filep->private_data,
						 struct wcd_dsp_cntl, miscdev);
						 struct wcd_dsp_cntl, miscdev);
	char val[WCD_MISCDEV_CMD_MAX_LEN];
	char val[WCD_MISCDEV_CMD_MAX_LEN + 1];
	bool vote;
	bool vote;
	int ret = 0;
	int ret = 0;


	memset(val, 0, WCD_MISCDEV_CMD_MAX_LEN + 1);

	if (count == 0 || count > WCD_MISCDEV_CMD_MAX_LEN) {
	if (count == 0 || count > WCD_MISCDEV_CMD_MAX_LEN) {
		pr_err("%s: Invalid count = %zd\n", __func__, count);
		pr_err("%s: Invalid count = %zd\n", __func__, count);
		ret = -EINVAL;
		ret = -EINVAL;