ols: fixed *ctx null dereferences that would SEGFAULT on probing for a OLS or attempting to read from it.
Signed-off-by: Matt Ranostay <mranostay@gmail.com>
This commit is contained in:
parent
9031ce63f3
commit
13d0d2698c
|
@ -445,6 +445,7 @@ static int hw_init(const char *devinfo)
|
||||||
/* got metadata */
|
/* got metadata */
|
||||||
sdi = get_metadata(fds[i].fd);
|
sdi = get_metadata(fds[i].fd);
|
||||||
sdi->index = final_devcnt;
|
sdi->index = final_devcnt;
|
||||||
|
ctx = sdi->priv;
|
||||||
} else {
|
} else {
|
||||||
/* not an OLS -- some other board that uses the sump protocol */
|
/* not an OLS -- some other board that uses the sump protocol */
|
||||||
sdi = sr_dev_inst_new(final_devcnt, SR_ST_INACTIVE,
|
sdi = sr_dev_inst_new(final_devcnt, SR_ST_INACTIVE,
|
||||||
|
@ -705,10 +706,11 @@ static int receive_data(int fd, int revents, void *cb_data)
|
||||||
ctx = NULL;
|
ctx = NULL;
|
||||||
for (l = dev_insts; l; l = l->next) {
|
for (l = dev_insts; l; l = l->next) {
|
||||||
sdi = l->data;
|
sdi = l->data;
|
||||||
|
ctx = sdi->priv;
|
||||||
if (ctx->serial->fd == fd) {
|
if (ctx->serial->fd == fd) {
|
||||||
ctx = sdi->priv;
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
ctx = NULL;
|
||||||
}
|
}
|
||||||
if (!ctx)
|
if (!ctx)
|
||||||
/* Shouldn't happen. */
|
/* Shouldn't happen. */
|
||||||
|
|
Loading…
Reference in New Issue