dm: mei: fix clients scan in sysfs

Fix the prefix comparison, we need to compare on prefix length, not
on devpath len, otherwise we always fail.

Tracked-On: #1848
Signed-off-by: Alexander Usyskin <alexander.usyskin@intel.com>
Signed-off-by: Tomas Winkler <tomas.winkler@intel.com>
Acked-by: Acked-by: Yu Wang <yu1.wang@intel.com>
This commit is contained in:
Alexander Usyskin 2018-11-19 10:24:08 +02:00 committed by lijinxia
parent 7bd2976f9c
commit 378afc5093
1 changed files with 3 additions and 2 deletions

View File

@ -766,12 +766,13 @@ static int mei_sysfs_read_properties(char *devpath, size_t size, size_t offset,
return 0; return 0;
} }
static bool is_prefix(const char *prfx, const char *str, size_t maxlen) static bool is_prefix(const char *prfx, const char *str, size_t maxlen)
{ {
if (!prfx || !str || prfx[0] == '\0') if (!prfx || !str)
return false; return false;
return strncmp(prfx, str, maxlen); return strncmp(prfx, str, strnlen(prfx, maxlen)) == 0;
} }
static int vmei_me_client_scan_list(struct virtio_mei *vmei) static int vmei_me_client_scan_list(struct virtio_mei *vmei)