From: Lior David Date: Mon, 21 Mar 2016 20:01:11 +0000 (+0200) Subject: wil6210: allow empty WMI commands in debugfs wmi_send X-Git-Tag: v4.7-rc1~154^2~319^2^2~4 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=69218a48005d0c93b8e9ec483f42ead481a43034;p=thirdparty%2Fkernel%2Flinux.git wil6210: allow empty WMI commands in debugfs wmi_send There are many valid WMI commands with only header without any additional payload. Such WMI commands could not be sent using the debugfs wmi_send facility. Fix the code to allow sending of such commands. Signed-off-by: Lior David Signed-off-by: Maya Erez Signed-off-by: Kalle Valo --- diff --git a/drivers/net/wireless/ath/wil6210/debugfs.c b/drivers/net/wireless/ath/wil6210/debugfs.c index a4d3f70c3d29b..b338a09175ad5 100644 --- a/drivers/net/wireless/ath/wil6210/debugfs.c +++ b/drivers/net/wireless/ath/wil6210/debugfs.c @@ -832,7 +832,7 @@ static ssize_t wil_write_file_wmi(struct file *file, const char __user *buf, u16 cmdid; int rc, rc1; - if (cmdlen <= 0) + if (cmdlen < 0) return -EINVAL; wmi = kmalloc(len, GFP_KERNEL); @@ -845,7 +845,7 @@ static ssize_t wil_write_file_wmi(struct file *file, const char __user *buf, return rc; } - cmd = &wmi[1]; + cmd = (cmdlen > 0) ? &wmi[1] : NULL; cmdid = le16_to_cpu(wmi->command_id); rc1 = wmi_send(wil, cmdid, cmd, cmdlen);