All of lore.kernel.org
 help / color / mirror / Atom feed
From: Rob Herring <robh@kernel.org>
To: Sergey Shtylyov <s.shtylyov@omp.ru>
Cc: devicetree@vger.kernel.org,
	Saravana Kannan <saravanak@google.com>,
	Alexey Khoroshilov <khoroshilov@ispras.ru>
Subject: Re: [PATCH RESEND] of: module: add buffer overflow check in of_modalias()
Date: Mon, 15 Apr 2024 14:35:34 -0500	[thread overview]
Message-ID: <20240415193534.GA81190-robh@kernel.org> (raw)
In-Reply-To: <bbfc6be0-c687-62b6-d015-5141b93f313e@omp.ru>

On Sun, Apr 14, 2024 at 11:51:39AM +0300, Sergey Shtylyov wrote:
> In of_modalias(), if the buffer happens to be too small even for the 1st
> snprintf() call, the len parameter will become negative and str parameter
> (if not NULL initially) will point beyond the buffer's end. Add the buffer
> overflow check after the 1st snprintf() call and fix such check after the
> strlen() call (accounting for the terminating NUL char).
> 
> Fixes: bc575064d688 ("of/device: use of_property_for_each_string to parse compatible strings")
> Signed-off-by: Sergey Shtylyov <s.shtylyov@omp.ru>
> 
> ---
> The patch is against the dt/linus branch of Rob Herring's linux.git repo...
> 
>  drivers/of/module.c |    7 ++++---
>  1 file changed, 4 insertions(+), 3 deletions(-)

Applied, thanks.

      reply	other threads:[~2024-04-15 19:35 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-04-14  8:51 [PATCH RESEND] of: module: add buffer overflow check in of_modalias() Sergey Shtylyov
2024-04-15 19:35 ` Rob Herring [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=20240415193534.GA81190-robh@kernel.org \
    --to=robh@kernel.org \
    --cc=devicetree@vger.kernel.org \
    --cc=khoroshilov@ispras.ru \
    --cc=s.shtylyov@omp.ru \
    --cc=saravanak@google.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.