Skip to content

Commit 8e37f9f

Browse files
cristina-suteupcercuei
authored andcommitted
channel: don't look for attributes for iio_channel_attr_write_all
iio_channel_attr_write_all calls iio_channel_attr_write with attr set to NULL, causing a segmentation fault when attr is NULL, iio_channel_find_attr is skipped Signed-off-by: Cristina Suteu <[email protected]>
1 parent 1f48c1e commit 8e37f9f

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

channel.c

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -403,9 +403,11 @@ ssize_t iio_channel_attr_read(const struct iio_channel *chn,
403403
ssize_t iio_channel_attr_write_raw(const struct iio_channel *chn,
404404
const char *attr, const void *src, size_t len)
405405
{
406-
attr = iio_channel_find_attr(chn, attr);
407-
if (!attr)
408-
return -ENOENT;
406+
if (attr) {
407+
attr = iio_channel_find_attr(chn, attr);
408+
if (!attr)
409+
return -ENOENT;
410+
}
409411

410412
if (chn->dev->ctx->ops->write_channel_attr)
411413
return chn->dev->ctx->ops->write_channel_attr(chn,

0 commit comments

Comments
 (0)