提交 be4a1326 编写于 作者: B Brian Norris 提交者: Shuah Khan

test: firmware_class: use kstrndup() where appropriate

We're essentially just doing an open-coded kstrndup(). The only
differences are with what happens after the first '\0' character, but
request_firmware() doesn't care about that.
Suggested-by: NKees Cook <keescook@chromium.org>
Signed-off-by: NBrian Norris <computersforpeace@gmail.com>
Signed-off-by: NShuah Khan <shuahkh@osg.samsung.com>
上级 47e0bbb7
......@@ -54,10 +54,9 @@ static ssize_t trigger_request_store(struct device *dev,
int rc;
char *name;
name = kzalloc(count + 1, GFP_KERNEL);
name = kstrndup(buf, count, GFP_KERNEL);
if (!name)
return -ENOSPC;
memcpy(name, buf, count);
pr_info("loading '%s'\n", name);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册