* [PATCH] firewire: cdev: Check return value in ioctl_get_cycle_timer()
@ 2026-10-29 10:15 Sreeraj S Kurup
0 siblings, 0 replies; only message in thread
From: Sreeraj S Kurup @ 2026-10-29 10:15 UTC (permalink / raw)
To: o-takashi; +Cc: linux1394-devel, linux-kernel, Sreeraj S Kurup
ioctl_get_cycle_timer() ignores the return value of
ioctl_get_cycle_timer2(). If the latter fails, the output fields
may remain uninitialized, causing the caller to use uninitialized
data when calculating local_time and assigning cycle_timer.
Check the return value and propagate the error to the caller.
Signed-off-by: Sreeraj S Kurup <sreekuttan2156239@gmail.com>
---
drivers/firewire/core-cdev.c | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)
diff --git a/drivers/firewire/core-cdev.c b/drivers/firewire/core-cdev.c
index 87efd65e6b00..76606c37d212 100644
--- a/drivers/firewire/core-cdev.c
+++ b/drivers/firewire/core-cdev.c
@@ -1316,9 +1316,12 @@ static int ioctl_get_cycle_timer(struct client *client, union ioctl_arg *arg)
{
struct fw_cdev_get_cycle_timer *a = &arg->get_cycle_timer;
struct fw_cdev_get_cycle_timer2 ct2;
+ int ret;
ct2.clk_id = CLOCK_REALTIME;
- ioctl_get_cycle_timer2(client, (union ioctl_arg *)&ct2);
+ ret = ioctl_get_cycle_timer2(client, (union ioctl_arg *)&ct2);
+ if (ret < 0)
+ return ret;
a->local_time = ct2.tv_sec * USEC_PER_SEC + ct2.tv_nsec / NSEC_PER_USEC;
a->cycle_timer = ct2.cycle_timer;
--
2.55.0
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2026-10-29 10:16 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-10-29 10:15 [PATCH] firewire: cdev: Check return value in ioctl_get_cycle_timer() Sreeraj S Kurup
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®