提交 f5b8f479 编写于 作者: L Luciano Coelho 提交者: John W. Linville

wlcore: check minimum buffer size in some cmd_send functions

Check for the minimum required buffer length in wlcore_cmd_send() and
wlcore_cmd_configure_failsafe.  This ensures that we will never try to
use a buffer that is smaller than the required header.
Reported-by: NDan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: NLuciano Coelho <luciano.coelho@intel.com>
Signed-off-by: NJohn W. Linville <linville@tuxdriver.com>
上级 0d4b5c7c
......@@ -64,6 +64,9 @@ static int __wlcore_cmd_send(struct wl1271 *wl, u16 id, void *buf,
id != CMD_STOP_FWLOGGER))
return -EIO;
if (WARN_ON_ONCE(len < sizeof(*cmd)))
return -EIO;
cmd = buf;
cmd->id = cpu_to_le16(id);
cmd->status = 0;
......@@ -891,6 +894,9 @@ int wlcore_cmd_configure_failsafe(struct wl1271 *wl, u16 id, void *buf,
wl1271_debug(DEBUG_CMD, "cmd configure (%d)", id);
if (WARN_ON_ONCE(len < sizeof(*acx)))
return -EIO;
acx->id = cpu_to_le16(id);
/* payload length, does not include any headers */
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册