提交 8b613bb8 编写于 作者: T Tomas Winkler 提交者: Greg Kroah-Hartman

mei: bus: do not overflow the device name buffer

1. use strncmp for comparsion strncpy was used for copying
which may omit the final %NUL terminator
2. id->name is statically defined so we can use sizeof
Acked-by: NSamuel Ortiz <sameo@linux.intel.com>
Signed-off-by: NTomas Winkler <tomas.winkler@intel.com>
Signed-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
上级 5290801c
......@@ -47,7 +47,7 @@ static int mei_cl_device_match(struct device *dev, struct device_driver *drv)
id = driver->id_table;
while (id->name[0]) {
if (!strcmp(dev_name(dev), id->name))
if (!strncmp(dev_name(dev), id->name, sizeof(id->name)))
return 1;
id++;
......@@ -71,7 +71,7 @@ static int mei_cl_device_probe(struct device *dev)
dev_dbg(dev, "Device probe\n");
strncpy(id.name, dev_name(dev), MEI_CL_NAME_SIZE);
strncpy(id.name, dev_name(dev), sizeof(id.name));
return driver->probe(device, &id);
}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册