public inbox for devicetree@vger.kernel.org
 help / color / mirror / Atom feed
From: "Rob Herring (Arm)" <robh@kernel.org>
To: Pengpeng Hou <pengpeng@iscas.ac.cn>
Cc: Saravana Kannan <saravanak@kernel.org>,
	linux-kernel@vger.kernel.org, devicetree@vger.kernel.org
Subject: Re: [PATCH v2] drivers/of: fdt: validate flat DT string properties before string use
Date: Mon, 13 Apr 2026 11:59:57 -0500	[thread overview]
Message-ID: <177609959360.2991413.1621235298021161008.robh@kernel.org> (raw)
In-Reply-To: <20260403164501.1-drivers-of-fdt-v2-pengpeng@iscas.ac.cn>


On Fri, 03 Apr 2026 13:59:47 +0800, Pengpeng Hou wrote:
> Firmware-supplied flat DT properties are raw byte sequences. Several
> early FDT helpers fetch properties such as status, model, compatible,
> and device_type and then use them as C strings with strcmp(), strlen(),
> or pr_info() without first proving that the property is NUL-terminated
> within its declared length.
> 
> Use fdt_stringlist_get() for these string properties instead. That
> preserves the existing behavior for valid DTBs while rejecting malformed
> unterminated properties before they are passed to C string helpers.
> 
> Signed-off-by: Pengpeng Hou <pengpeng@iscas.ac.cn>
> ---
> Changes since v1:
> - also validate raw compatible string-list walks in `of_fdt_is_compatible()`
> 
>  drivers/of/fdt.c | 38 ++++++++++++++------------------------
>  1 file changed, 14 insertions(+), 24 deletions(-)
> 

Applied, thanks!


      reply	other threads:[~2026-04-13 16:59 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-04-03  5:59 [PATCH v2] drivers/of: fdt: validate flat DT string properties before string use Pengpeng Hou
2026-04-13 16:59 ` Rob Herring (Arm) [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=177609959360.2991413.1621235298021161008.robh@kernel.org \
    --to=robh@kernel.org \
    --cc=devicetree@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=pengpeng@iscas.ac.cn \
    --cc=saravanak@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