tools: iio: iio_generic_buffer: initialize channel array pointer
PATCH 1/1 tools: iio: iio_generic_buffer: initialize channel array pointer
Uninitialized channel pointer causes segmentation fault when we call free(channel) during cleanup() with no channels initialized. This happens when you exit early for usage errors. Initialize the pointer to NULL when it is declared.
--- tools/iio/iio_generic_buffer.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
tools/iio/iio_generic_buffer.c +1 -1
@@ -348,7 +348,7 @@ int main(int argc, char **argv)int notrigger =0 ;char *dummy; -struct iio_channel_info *channels; +struct iio_channel_info *channels =NULL ;register_cleanup ();
Signature · 1 line
2.1.4
Quoted 16 lines · Alison Schofield
Uninitialized channel pointer causes segmentation fault when we call free(channel) during
cleanup()with no channels initialized. This happens when you exit early for usage errors. Initialize the pointer to NULL when it is declared.Signed-off-by Alison Schofield <[email protected]>Cc Daniel Baluta <[email protected]>--- tools/iio/iio_generic_buffer.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)tools/iio/iio_generic_buffer.c +0
-0
tools/iio/iio_generic_buffer.c int main(int argc, char **argv) · line 354
Quoted 8 lines
tools/iio/iio_generic_buffer.c +1
-1@@ -348,7 +348,7 @@ int main(int argc, char **argv)int notrigger =0 ;char *dummy; -struct iio_channel_info *channels; +struct iio_channel_info *channels =NULL ;register_cleanup ();
greg.
Jonathan Cameron
maintainerQuoted 13 lines · Gregor Boirie
Quoted 11 lines · Alison Schofield
Uninitialized channel pointer causes segmentation fault when we call free(channel) during
cleanup()with no channels initialized. This happens when you exit early for usage errors. Initialize the pointer to NULL when it is declared.Signed-off-by Alison Schofield <[email protected]>Cc Daniel Baluta <[email protected]>--- tools/iio/iio_generic_buffer.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
Quoted 12 lines
tools/iio/iio_generic_buffer.c int main(int argc, char **argv) · line 353
Quoted 11 lines
tools/iio/iio_generic_buffer.c +1
-0@@ -348,7 +348,7 @@ int main(int argc, char **argv)int notrigger =0 ;char *dummy; - struct iio_channel_info *channels; +struct iio_channel_info *channels =NULL ;register_cleanup ();Tested-by Gregor Boirie <[email protected]>
I'm not marking this for stable purely because the huge about of churn in those files makes it tricky to be sure when it first broke or if it was always broken!
Anyhow, applied to the fixes-togreg branch of iio.git.
Thanks,
Jonathan
Quoted 6 lines
greg.
Signature · 3 lines
To unsubscribe from this list: send the line "unsubscribe linux-iio" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html