From: sashiko-bot@kernel.org
To: "Jinseob Kim" <kimjinseob88@gmail.com>
Cc: robh@kernel.org, devicetree@vger.kernel.org, conor+dt@kernel.org
Subject: Re: [PATCH v7 3/5] iio: osf: add protocol decoding
Date: Tue, 07 Jul 2026 01:51:34 +0000 [thread overview]
Message-ID: <20260707015135.1B06B1F000E9@smtp.kernel.org> (raw)
In-Reply-To: <20260707014525.1015-4-kimjinseob88@gmail.com>
Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
- [Medium] The protocol major version and header reserved fields are not validated, contradicting the commit message.
--
--- Patch [3]: [PATCH v7 3/5] iio: osf: add protocol decoding ---
commit 4b68faaa805d7ad7aeb0c1d32700ea5abc7cccf2
Author: Jinseob Kim <kimjinseob88@gmail.com>
iio: osf: add protocol decoding
This commit adds helpers for decoding Open Sensor Fusion frame headers and
supported message payloads.
> diff --git a/drivers/iio/opensensorfusion/osf_protocol.c b/drivers/iio/opensensorfusion/osf_protocol.c
> new file mode 100644
> index 0000000000000..b5749525e4c43
> --- /dev/null
> +++ b/drivers/iio/opensensorfusion/osf_protocol.c
[ ... ]
> +int osf_protocol_decode_frame(const u8 *buf, size_t len,
> + struct osf_frame *frame, size_t *frame_len)
> +{
> + u32 expected_crc;
> + u32 actual_crc;
> + u32 payload_len;
> + size_t total_len;
[ ... ]
> + if (actual_crc != expected_crc)
> + return -EBADMSG;
> +
> + frame->protocol_major = buf[4];
> + frame->protocol_minor = buf[5];
> + frame->message_type = get_unaligned_le16(buf + 8);
> + frame->payload_len = payload_len;
> + frame->sequence = get_unaligned_le64(buf + 14);
> + frame->timestamp_us = get_unaligned_le64(buf + 22);
> + frame->flags = get_unaligned_le32(buf + 30);
> + frame->reserved = get_unaligned_le32(buf + 34);
[Severity: Medium]
The commit message states: "The decoder validates the OSF0 wire magic,
protocol major version, header length, payload bounds, reserved fields
and CRC..."
Are the protocol major version and reserved fields actually being validated
here in osf_protocol_decode_frame()?
It looks like buf[4] is being assigned directly to frame->protocol_major
without checking it against OSF_PROTOCOL_MAJOR, and the reserved field is
similarly assigned without verifying if it is zero. Could this lead to
compatibility issues if a future protocol major version reuses the same
magic number but alters field semantics?
--
Sashiko AI review · https://sashiko.dev/#/patchset/20260707014525.1015-1-kimjinseob88@gmail.com?part=3
next prev parent reply other threads:[~2026-07-07 1:51 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-07-07 1:45 [PATCH v7 0/5] iio: add Open Sensor Fusion IIO driver Jinseob Kim
2026-07-07 1:45 ` [PATCH v7 1/5] dt-bindings: iio: add Open Sensor Fusion device Jinseob Kim
2026-07-07 1:50 ` sashiko-bot
2026-07-07 1:45 ` [PATCH v7 2/5] Documentation: iio: add Open Sensor Fusion driver overview Jinseob Kim
2026-07-07 4:07 ` Randy Dunlap
2026-07-07 1:45 ` [PATCH v7 3/5] iio: osf: add protocol decoding Jinseob Kim
2026-07-07 1:51 ` sashiko-bot [this message]
2026-07-07 1:45 ` [PATCH v7 4/5] iio: osf: add authenticated stream parser Jinseob Kim
2026-07-07 1:45 ` [PATCH v7 5/5] iio: osf: add UART IIO driver Jinseob Kim
2026-07-07 8:47 ` Uwe Kleine-König
2026-07-07 8:48 ` Uwe Kleine-König
2026-07-07 9:00 ` Joshua Crofts
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=20260707015135.1B06B1F000E9@smtp.kernel.org \
--to=sashiko-bot@kernel.org \
--cc=conor+dt@kernel.org \
--cc=devicetree@vger.kernel.org \
--cc=kimjinseob88@gmail.com \
--cc=robh@kernel.org \
--cc=sashiko-reviews@lists.linux.dev \
/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.