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

Commit 0133ca6d authored by qctecmdr Service's avatar qctecmdr Service Committed by Gerrit - the friendly Code Review server
Browse files

Merge "diag: Avoid usage of variable length array"

parents 582df5da 60d25c20
Loading
Loading
Loading
Loading
+3 −3
Original line number Diff line number Diff line
@@ -38,6 +38,7 @@
#include "diag_ipc_logging.h"

#define DEBUG_BUF_SIZE	4096
#define CMD_SIZE 10
static struct dentry *diag_dbgfs_dent;
static int diag_dbgfs_table_index;
static int diag_dbgfs_mempool_index;
@@ -689,15 +690,14 @@ static ssize_t diag_dbgfs_read_rpmsginfo(struct file *file, char __user *ubuf,
static ssize_t diag_dbgfs_write_debug(struct file *fp, const char __user *buf,
				      size_t count, loff_t *ppos)
{
	const int size = 10;
	unsigned char cmd[size];
	unsigned char cmd[CMD_SIZE];
	long value = 0;
	int len = 0;

	if (count < 1)
		return -EINVAL;

	len = (count < (size - 1)) ? count : size - 1;
	len = (count < (CMD_SIZE - 1)) ? count : CMD_SIZE - 1;
	if (copy_from_user(cmd, buf, len))
		return -EFAULT;