static inline void __assign_req_name(char *name, struct nvmet_req *req)
{
+ size_t len = min_t(size_t, DISK_NAME_LEN, strlen(req->ns->device_path));
+
if (req->ns)
- strncpy(name, req->ns->device_path, DISK_NAME_LEN);
+ strncpy(name, req->ns->device_path, len);
else
memset(name, 0, DISK_NAME_LEN);
This could dereference a NULL req->ns. I've changed the patch
to eliminate the local variable and to return early for the NULL
req->ns case.
_______________________________________________
Linux-nvme mailing list
Linux-nvme@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-nvme