* [PATCH] media: pci: mg4b: fix uninitialized iio scan data
@ 2025-07-22 22:05 David Lechner
2025-07-24 10:56 ` Jonathan Cameron
0 siblings, 1 reply; 2+ messages in thread
From: David Lechner @ 2025-07-22 22:05 UTC (permalink / raw)
To: Martin Tuma, Mauro Carvalho Chehab, Hans Verkuil
Cc: linux-media, linux-kernel, Jonathan Cameron, Nuno Sá,
Andy Shevchenko, linux-iio, linux-kernel, David Lechner
Fix potential leak of uninitialized stack data to userspace by ensuring
that the `scan` structure is zeroed before use.
Fixes: 0ab13674a9bd ("media: pci: mgb4: Added Digiteq Automotive MGB4 driver")
Signed-off-by: David Lechner <dlechner@baylibre.com>
---
drivers/media/pci/mgb4/mgb4_trigger.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/media/pci/mgb4/mgb4_trigger.c b/drivers/media/pci/mgb4/mgb4_trigger.c
index 923650d53d4c82e87b542f87c3a0fbf6170dadc8..d7dddc5c8728e81c6249b03a4cbf692da15a4ced 100644
--- a/drivers/media/pci/mgb4/mgb4_trigger.c
+++ b/drivers/media/pci/mgb4/mgb4_trigger.c
@@ -91,7 +91,7 @@ static irqreturn_t trigger_handler(int irq, void *p)
struct {
u32 data;
s64 ts __aligned(8);
- } scan;
+ } scan = { };
scan.data = mgb4_read_reg(&st->mgbdev->video, 0xA0);
mgb4_write_reg(&st->mgbdev->video, 0xA0, scan.data);
---
base-commit: cd2731444ee4e35db76f4fb587f12d327eec5446
change-id: 20250722-media-pci-mg4b-fix-uninitialized-iio-scan-data-2dce1574d1e9
Best regards,
--
David Lechner <dlechner@baylibre.com>
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: [PATCH] media: pci: mg4b: fix uninitialized iio scan data
2025-07-22 22:05 [PATCH] media: pci: mg4b: fix uninitialized iio scan data David Lechner
@ 2025-07-24 10:56 ` Jonathan Cameron
0 siblings, 0 replies; 2+ messages in thread
From: Jonathan Cameron @ 2025-07-24 10:56 UTC (permalink / raw)
To: David Lechner
Cc: Martin Tuma, Mauro Carvalho Chehab, Hans Verkuil, linux-media,
linux-kernel, Nuno Sá,
Andy Shevchenko, linux-iio
On Tue, 22 Jul 2025 17:05:46 -0500
David Lechner <dlechner@baylibre.com> wrote:
> Fix potential leak of uninitialized stack data to userspace by ensuring
> that the `scan` structure is zeroed before use.
>
> Fixes: 0ab13674a9bd ("media: pci: mgb4: Added Digiteq Automotive MGB4 driver")
> Signed-off-by: David Lechner <dlechner@baylibre.com>
Reviewed-by: Jonathan Cameron <jonathan.cameron@huawei.com>
> ---
> drivers/media/pci/mgb4/mgb4_trigger.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/media/pci/mgb4/mgb4_trigger.c b/drivers/media/pci/mgb4/mgb4_trigger.c
> index 923650d53d4c82e87b542f87c3a0fbf6170dadc8..d7dddc5c8728e81c6249b03a4cbf692da15a4ced 100644
> --- a/drivers/media/pci/mgb4/mgb4_trigger.c
> +++ b/drivers/media/pci/mgb4/mgb4_trigger.c
> @@ -91,7 +91,7 @@ static irqreturn_t trigger_handler(int irq, void *p)
> struct {
> u32 data;
> s64 ts __aligned(8);
If you don't mind doing a follow up can change that to aligned_s64
and switch to iio_push_to_buffers_with_ts()
If not the second one at least will get swept up with other conversions
shortly and the aligned_s64 is just a nice to have.
> - } scan;
> + } scan = { };
>
> scan.data = mgb4_read_reg(&st->mgbdev->video, 0xA0);
> mgb4_write_reg(&st->mgbdev->video, 0xA0, scan.data);
>
> ---
> base-commit: cd2731444ee4e35db76f4fb587f12d327eec5446
> change-id: 20250722-media-pci-mg4b-fix-uninitialized-iio-scan-data-2dce1574d1e9
>
> Best regards,
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2025-07-24 10:56 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2025-07-22 22:05 [PATCH] media: pci: mg4b: fix uninitialized iio scan data David Lechner
2025-07-24 10:56 ` Jonathan Cameron
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®