From: Takashi Sakamoto <o-takashi@sakamocchi.jp>
To: Dan Carpenter <dan.carpenter@oracle.com>
Cc: alsa-devel@alsa-project.org,
linux1394-devel@lists.sourceforge.net,
linux-kernel@vger.kernel.org
Subject: Re: [bug report] firewire: add kernel API to access CYCLE_TIME register
Date: Tue, 12 Apr 2022 20:22:04 +0900 [thread overview]
Message-ID: <YlVg3I8kLIcBLZAE@workstation> (raw)
In-Reply-To: <20220411070124.GA12881@kili>
Hi,
On Mon, Apr 11, 2022 at 10:01:25AM +0300, Dan Carpenter wrote:
> Hello Takashi Sakamoto,
>
> The patch baa914cd81f5: "firewire: add kernel API to access
> CYCLE_TIME register" from Apr 5, 2022, leads to the following Smatch
> static checker warning:
>
> drivers/firewire/core-cdev.c:1235 ioctl_get_cycle_timer2()
> error: uninitialized symbol 'cycle_time'.
>
> drivers/firewire/core-cdev.c
> 1209 static int ioctl_get_cycle_timer2(struct client *client, union ioctl_arg *arg)
> 1210 {
> 1211 struct fw_cdev_get_cycle_timer2 *a = &arg->get_cycle_timer2;
> 1212 struct fw_card *card = client->device->card;
> 1213 struct timespec64 ts = {0, 0};
> 1214 u32 cycle_time;
> 1215 int ret = 0;
> 1216
> 1217 local_irq_disable();
> 1218
> 1219 ret = fw_card_read_cycle_time(card, &cycle_time);
> 1220 if (ret < 0)
> 1221 goto end;
> ^^^^^^^^
> "cycle_time" not initialized on error path.
>
> 1222
> 1223 switch (a->clk_id) {
> 1224 case CLOCK_REALTIME: ktime_get_real_ts64(&ts); break;
> 1225 case CLOCK_MONOTONIC: ktime_get_ts64(&ts); break;
> 1226 case CLOCK_MONOTONIC_RAW: ktime_get_raw_ts64(&ts); break;
> 1227 default:
> 1228 ret = -EINVAL;
> 1229 }
> 1230 end:
> 1231 local_irq_enable();
> 1232
> 1233 a->tv_sec = ts.tv_sec;
> 1234 a->tv_nsec = ts.tv_nsec;
> --> 1235 a->cycle_timer = cycle_time;
> 1236
> 1237 return ret;
> 1238 }
Thanks for the report. Indeed, it leaks the unidentified value on kernel
stack to userspace. I'll post fix later.
Regards
Takashi Sakamoto
parent reply other threads:[~2022-04-12 11:23 UTC|newest]
Thread overview: expand[flat|nested] mbox.gz Atom feed
[parent not found: <20220411070124.GA12881@kili>]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=YlVg3I8kLIcBLZAE@workstation \
--to=o-takashi@sakamocchi.jp \
--cc=alsa-devel@alsa-project.org \
--cc=dan.carpenter@oracle.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux1394-devel@lists.sourceforge.net \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.