Commit a6f14e3e authored by Federico Vaga's avatar Federico Vaga

sw:drv: bugfix missing copy_from_user

Signed-off-by: Federico Vaga's avatarFederico Vaga <federico.vaga@cern.ch>
parent 945e9c60
...@@ -64,17 +64,26 @@ static const struct file_operations spec_irq_dbg_info_ops = { ...@@ -64,17 +64,26 @@ static const struct file_operations spec_irq_dbg_info_ops = {
.release = single_release, .release = single_release,
}; };
#define SPEC_DBG_FW_BUF_LEN 128
static ssize_t spec_dbg_fw_write(struct file *file, static ssize_t spec_dbg_fw_write(struct file *file,
const char __user *buf, const char __user *buf,
size_t count, loff_t *ppos) size_t count, loff_t *ppos)
{ {
struct spec_gn412x *spec_gn412x = file->private_data; struct spec_gn412x *spec_gn412x = file->private_data;
char buf_l[SPEC_DBG_FW_BUF_LEN];
int err; int err;
if (!buf || !count) { if (SPEC_DBG_FW_BUF_LEN < count) {
dev_err(&spec_gn412x->pdev->dev, "Invalid input\n"); dev_err(&spec_gn412x->pdev->dev,
"Firmware name too long max %u\n",
SPEC_DBG_FW_BUF_LEN);
return -EINVAL; return -EINVAL;
} }
memset(buf_l, 0, SPEC_DBG_FW_BUF_LEN);
err = copy_from_user(buf_l, buf, count);
if (err)
return -EFAULT;
err = spec_fw_load(spec_gn412x, buf); err = spec_fw_load(spec_gn412x, buf);
if (err) if (err)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment