Second attempt to fix crash

Linus pointed out that it might be another call site (and looking at his
proposed patch I noticed a logic error in my earlier attempt)

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This commit is contained in:
Dirk Hohndel 2016-09-20 09:10:02 -07:00
parent 92caf2771b
commit c809a8873c
2 changed files with 2 additions and 2 deletions

View file

@ -193,7 +193,7 @@ static void match_id(void *_dc, const char *model, uint32_t deviceid,
if (dc->deviceid != deviceid)
return;
if (strcmp(dc->model, model))
if (!model || !dc->model || strcmp(dc->model, model))
return;
if (serial && !dc->serial)

View file

@ -498,7 +498,7 @@ static void dc_match_serial(void *_dc, const char *model, uint32_t deviceid, con
if (!deviceid)
return;
if (!dc->model && (!model || strcasecmp(dc->model, model)))
if (!dc->model || !model || strcasecmp(dc->model, model))
return;
if (!dc->serial || !serial || strcasecmp(dc->serial, serial))
return;