From: Marcus Folkesson <marcus.folkesson@gmail.com>
To: Jiri Kosina <jikos@kernel.org>,
Jonathan Cameron <jic23@kernel.org>,
Srinivas Pandruvada <srinivas.pandruvada@linux.intel.com>,
Benjamin Tissoires <benjamin.tissoires@redhat.com>
Cc: linux-input@vger.kernel.org, linux-iio@vger.kernel.org,
linux-kernel@vger.kernel.org,
Jonathan Cameron <Jonathan.Cameron@huawei.com>
Subject: Re: [PATCH v2] HID: hid-sensor-custom: set fixed size for custom attributes
Date: Thu, 17 Nov 2022 13:15:53 +0100 [thread overview]
Message-ID: <Y3Yl+eJndSuoV0vn@gmail.com> (raw)
In-Reply-To: <20221117121326.5621-1-marcus.folkesson@gmail.com>
[-- Attachment #1: Type: text/plain, Size: 1425 bytes --]
On Thu, Nov 17, 2022 at 01:13:26PM +0100, Marcus Folkesson wrote:
> This is no bugfix (so no Fixes: tag is necessary) as it is
> taken care of in hid_sensor_custom_add_attributes().
>
> The motivation for this patch is that:
> hid_sensor_custom_field.attr_name and
> hid_sensor_custom_field.attrs
> has the size of HID_CUSTOM_TOTAL_ATTRS and used in same context.
>
> We compare against HID_CUSTOM_TOTAL_ATTRS when
> looping through hid_custom_attrs.
>
> We will silent the smatch error:
> hid_sensor_custom_add_attributes() error: buffer overflow
> 'hid_custom_attrs' 8 <= 10
>
> Signed-off-by: Marcus Folkesson <marcus.folkesson@gmail.com>
> Acked-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
> ---
v2:
- add acked-by tag
> drivers/hid/hid-sensor-custom.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/hid/hid-sensor-custom.c b/drivers/hid/hid-sensor-custom.c
> index 32c2306e240d..602465ad2745 100644
> --- a/drivers/hid/hid-sensor-custom.c
> +++ b/drivers/hid/hid-sensor-custom.c
> @@ -62,7 +62,7 @@ struct hid_sensor_sample {
> u32 raw_len;
> } __packed;
>
> -static struct attribute hid_custom_attrs[] = {
> +static struct attribute hid_custom_attrs[HID_CUSTOM_TOTAL_ATTRS] = {
> {.name = "name", .mode = S_IRUGO},
> {.name = "units", .mode = S_IRUGO},
> {.name = "unit-expo", .mode = S_IRUGO},
> --
> 2.38.1
>
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]
next prev parent reply other threads:[~2022-11-17 12:14 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-11-17 12:13 [PATCH v2] HID: hid-sensor-custom: set fixed size for custom attributes Marcus Folkesson
2022-11-17 12:15 ` Marcus Folkesson [this message]
2022-11-21 21:14 ` Jiri Kosina
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=Y3Yl+eJndSuoV0vn@gmail.com \
--to=marcus.folkesson@gmail.com \
--cc=Jonathan.Cameron@huawei.com \
--cc=benjamin.tissoires@redhat.com \
--cc=jic23@kernel.org \
--cc=jikos@kernel.org \
--cc=linux-iio@vger.kernel.org \
--cc=linux-input@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=srinivas.pandruvada@linux.intel.com \
/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.