* [PATCH] firewire: cdev: Check return value in ioctl_get_cycle_timer()
@ 2026-10-29 10:15 Sreeraj S Kurup
2026-11-02 4:36 ` Takashi Sakamoto
0 siblings, 1 reply; 3+ messages 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] 3+ messages in thread* Re: [PATCH] firewire: cdev: Check return value in ioctl_get_cycle_timer()
2026-10-29 10:15 [PATCH] firewire: cdev: Check return value in ioctl_get_cycle_timer() Sreeraj S Kurup
@ 2026-11-02 4:36 ` Takashi Sakamoto
2026-11-02 6:44 ` Sreeraj S Kurup
0 siblings, 1 reply; 3+ messages in thread
From: Takashi Sakamoto @ 2026-11-02 4:36 UTC (permalink / raw)
To: Sreeraj S Kurup; +Cc: linux1394-devel, linux-kernel
Hi,
On Thu, Oct 29, 2026 at 10:15:45AM +0000, Sreeraj S Kurup wrote:
> 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(-)
Applied to for-next branch.
I prefer this submission to the previous ones from other contributors[1].
It's concise, to the point, and easy to read. When using generative AI in
our work, it's especially important to keep the intended recipients in
mind.
[1] https://lore.kernel.org/lkml/20260617023554.2789907-1-michael.bommarito@gmail.com/
Thanks
Takashi Sakamoto
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2026-11-02 6:45 UTC | newest]
Thread overview: 3+ messages (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
2026-11-02 4:36 ` Takashi Sakamoto
2026-11-02 6:44 ` 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®