Devicetree
 help / color / mirror / Atom feed
From: sashiko-bot@kernel.org
To: "Jorijn van der Graaf" <jorijnvdgraaf@catcrafts.net>
Cc: robh@kernel.org, devicetree@vger.kernel.org, conor+dt@kernel.org
Subject: Re: [PATCH v5 1/6] nfc: s3fwrn5: drop of_match_ptr() from the I2C driver
Date: Wed, 12 Aug 2026 22:15:01 +0000	[thread overview]
Message-ID: <20260812221501.EEE291F000E9@smtp.kernel.org> (raw)
In-Reply-To: <20260811220135.472380-2-jorijnvdgraaf@catcrafts.net>

Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:

Pre-existing issues:
- [High] Preexisting endianness bug in S3FWRN5 firmware packet length parsing and construction, leading to wrong length values on big-endian architectures.
--

--- Patch [1]: [PATCH v5 1/6] nfc: s3fwrn5: drop of_match_ptr() from the I2C driver ---
commit 5cffdb84b592ca672d62f53d2f736890c7d61164
Author: Jorijn van der Graaf <jorijnvdgraaf@catcrafts.net>

nfc: s3fwrn5: drop of_match_ptr() from the I2C driver

This commit drops of_match_ptr() from the I2C driver to ensure the same
code is used across all configurations. The OF match table now relies on
MODULE_DEVICE_TABLE() to count as used.

> diff --git a/drivers/nfc/s3fwrn5/i2c.c b/drivers/nfc/s3fwrn5/i2c.c
> index 4ba7626117118..cb73993446e09 100644
> --- a/drivers/nfc/s3fwrn5/i2c.c
> +++ b/drivers/nfc/s3fwrn5/i2c.c

[ ... ]

> @@ -219,7 +219,7 @@ MODULE_DEVICE_TABLE(of, of_s3fwrn5_i2c_match);
>  static struct i2c_driver s3fwrn5_i2c_driver = {
>  	.driver = {
>  		.name = S3FWRN5_I2C_DRIVER_NAME,
> -		.of_match_table = of_match_ptr(of_s3fwrn5_i2c_match),
> +		.of_match_table = of_s3fwrn5_i2c_match,
>  	},
>  	.probe = s3fwrn5_i2c_probe,
>  	.remove = s3fwrn5_i2c_remove,

[Severity: High]
This is a pre-existing issue, but does s3fwrn5_i2c_read() parse the firmware
header length correctly on big-endian systems?

Earlier in drivers/nfc/s3fwrn5/i2c.c:s3fwrn5_i2c_read():

	data_len = (phy->common.mode == S3FWRN5_MODE_NCI) ?
		((struct nci_ctrl_hdr *)hdr)->plen :
		((struct s3fwrn5_fw_header *)hdr)->len;

Because struct s3fwrn5_fw_header defines len as a __u16, reading it directly
from the packet without endianness conversion like le16_to_cpu() swaps the
bytes on big-endian architectures. 

Can this lead to allocating an incorrectly sized skb and breaking firmware
communication on these systems?

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20260811220135.472380-1-jorijnvdgraaf@catcrafts.net?part=1

  reply	other threads:[~2026-08-12 22:15 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-08-11 22:01 [PATCH v5 0/6] nfc: s3fwrn5: support the S3NRN4V variant Jorijn van der Graaf
2026-08-11 22:01 ` [PATCH v5 1/6] nfc: s3fwrn5: drop of_match_ptr() from the I2C driver Jorijn van der Graaf
2026-08-12 22:15   ` sashiko-bot [this message]
2026-08-11 22:01 ` [PATCH v5 2/6] nfc: s3fwrn5: use the "s3fwrn5_i2c" string literal directly Jorijn van der Graaf
2026-08-11 22:01 ` [PATCH v5 3/6] dt-bindings: net: nfc: samsung,s3fwrn5: add the S3NRN4V Jorijn van der Graaf
2026-08-11 22:01 ` [PATCH v5 4/6] nfc: s3fwrn5: enable the PVDD supply Jorijn van der Graaf
2026-08-11 22:01 ` [PATCH v5 5/6] nfc: s3fwrn5: support the S3NRN4V variant Jorijn van der Graaf
2026-08-12 11:18   ` David Heidelberg
2026-08-12 15:28     ` Jorijn van der Graaf
2026-08-12 22:15   ` sashiko-bot
2026-08-11 22:01 ` [PATCH v5 6/6] arm64: dts: qcom: milos-fairphone-fp6: Add NFC Jorijn van der Graaf
2026-08-12 22:15   ` sashiko-bot

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=20260812221501.EEE291F000E9@smtp.kernel.org \
    --to=sashiko-bot@kernel.org \
    --cc=conor+dt@kernel.org \
    --cc=devicetree@vger.kernel.org \
    --cc=jorijnvdgraaf@catcrafts.net \
    --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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox