From: Sean Young <sean@mess.org>
To: linux-media@vger.kernel.org
Cc: Dan Carpenter <dan.carpenter@oracle.com>, smatch@vger.kernel.org
Subject: [PATCH] media: lirc: suppress false positive smatch warning
Date: Thu, 10 Mar 2022 13:23:50 +0000 [thread overview]
Message-ID: <20220310132350.78729-1-sean@mess.org> (raw)
The latest smatch says:
drivers/media/rc/lirc_dev.c:632 lirc_read_mode2() error: uninitialized symbol 'copied'.
drivers/media/rc/lirc_dev.c:671 lirc_read_scancode() error: uninitialized symbol 'copied'.
This is a false positive since in all reaching code paths, copied will
be set. Work around this by providing a zero initializer for copied.
Cc: Dan Carpenter <dan.carpenter@oracle.com>
Cc: smatch@vger.kernel.org
Signed-off-by: Sean Young <sean@mess.org>
---
drivers/media/rc/lirc_dev.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/drivers/media/rc/lirc_dev.c b/drivers/media/rc/lirc_dev.c
index 765375bda0c6..efa09beae6a7 100644
--- a/drivers/media/rc/lirc_dev.c
+++ b/drivers/media/rc/lirc_dev.c
@@ -601,7 +601,7 @@ static ssize_t lirc_read_mode2(struct file *file, char __user *buffer,
{
struct lirc_fh *fh = file->private_data;
struct rc_dev *rcdev = fh->rc;
- unsigned int copied;
+ unsigned int copied = 0;
int ret;
if (length < sizeof(unsigned int) || length % sizeof(unsigned int))
@@ -639,7 +639,7 @@ static ssize_t lirc_read_scancode(struct file *file, char __user *buffer,
{
struct lirc_fh *fh = file->private_data;
struct rc_dev *rcdev = fh->rc;
- unsigned int copied;
+ unsigned int copied = 0;
int ret;
if (length < sizeof(struct lirc_scancode) ||
--
2.35.1
next reply other threads:[~2022-03-10 13:24 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-03-10 13:23 Sean Young [this message]
2022-03-10 14:42 ` [PATCH] media: lirc: suppress false positive smatch warning Dan Carpenter
2022-03-10 14:49 ` Sean Young
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=20220310132350.78729-1-sean@mess.org \
--to=sean@mess.org \
--cc=dan.carpenter@oracle.com \
--cc=linux-media@vger.kernel.org \
--cc=smatch@vger.kernel.org \
/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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).