From: Dmitry Torokhov <dmitry.torokhov@gmail.com>
To: Ricardo Ribalda <ribalda@chromium.org>
Cc: Mauro Carvalho Chehab <mchehab@kernel.org>,
Yasunari Takiguchi <Yasunari.Takiguchi@sony.com>,
Jean-Christophe Trotin <jean-christophe.trotin@foss.st.com>,
Lars-Peter Clausen <lars@metafoo.de>,
Hans Verkuil <hverkuil-cisco@xs4all.nl>,
linux-media@vger.kernel.org, linux-kernel@vger.kernel.org,
linux-input@vger.kernel.org
Subject: Re: [PATCH 6/6] media: touchscreen: sur40: convert le16 to cpu before use
Date: Mon, 15 Apr 2024 14:52:48 -0700 [thread overview]
Message-ID: <Zh2hsNpoaYs7GvCN@google.com> (raw)
In-Reply-To: <20240410-smatch-v1-6-785d009a852b@chromium.org>
On Wed, Apr 10, 2024 at 09:54:43PM +0000, Ricardo Ribalda wrote:
> Smatch found this issue:
> drivers/input/touchscreen/sur40.c:424:55: warning: incorrect type in argument 2 (different base types)
> drivers/input/touchscreen/sur40.c:424:55: expected int key
> drivers/input/touchscreen/sur40.c:424:55: got restricted __le16 [usertype] blob_id
>
> Signed-off-by: Ricardo Ribalda <ribalda@chromium.org>
> ---
> drivers/input/touchscreen/sur40.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/input/touchscreen/sur40.c b/drivers/input/touchscreen/sur40.c
> index ae3aab4283370..5f2cf8881e724 100644
> --- a/drivers/input/touchscreen/sur40.c
> +++ b/drivers/input/touchscreen/sur40.c
> @@ -421,7 +421,7 @@ static void sur40_report_blob(struct sur40_blob *blob, struct input_dev *input)
> if (blob->type != SUR40_TOUCH)
> return;
>
> - slotnum = input_mt_get_slot_by_key(input, blob->blob_id);
> + slotnum = input_mt_get_slot_by_key(input, le16_to_cpu(blob->blob_id));
We are not really using the real value of the ID for computations but only
as an opaque "key", so doing the conversion is not strictly necessary,
but it is cheap so we may as well do it.
> if (slotnum < 0 || slotnum >= MAX_CONTACTS)
> return;
Applied, thank you.
--
Dmitry
prev parent reply other threads:[~2024-04-15 21:52 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-04-10 21:54 [PATCH 0/6] media: Fix warnings for smatch and sparse Ricardo Ribalda
2024-04-10 21:54 ` [PATCH 1/6] media: usb: siano: Fix allocation of urbs Ricardo Ribalda
2024-04-15 10:08 ` Hans Verkuil
2024-04-15 11:47 ` Hans Verkuil
2024-04-10 21:54 ` [PATCH 2/6] media: cxd2880: Replaze kmalloc with kzalloc Ricardo Ribalda
2024-04-10 21:54 ` [PATCH 3/6] media: platform: sti: hva: clk_unprepare unconditionally Ricardo Ribalda
2024-04-10 21:54 ` [PATCH 4/6] media: v4l2-ctrls-core.c: Do not use iterator outside loop Ricardo Ribalda
2024-04-10 21:54 ` [PATCH 5/6] media: adv7180: Only request valids IRQs Ricardo Ribalda
2024-04-10 21:54 ` [PATCH 6/6] media: touchscreen: sur40: convert le16 to cpu before use Ricardo Ribalda
2024-04-15 21:52 ` Dmitry Torokhov [this message]
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=Zh2hsNpoaYs7GvCN@google.com \
--to=dmitry.torokhov@gmail.com \
--cc=Yasunari.Takiguchi@sony.com \
--cc=hverkuil-cisco@xs4all.nl \
--cc=jean-christophe.trotin@foss.st.com \
--cc=lars@metafoo.de \
--cc=linux-input@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-media@vger.kernel.org \
--cc=mchehab@kernel.org \
--cc=ribalda@chromium.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
all inboxes | Powered by JetHome®