Devicetree
 help / color / mirror / Atom feed
From: Rob Herring <robh@kernel.org>
To: Sergey Shtylyov <s.shtylyov@omp.ru>
Cc: lvc-project@linuxtesting.org, Rob Herring <robh+dt@kernel.org>,
	Saravana Kannan <saravanak@google.com>,
	Frank Rowand <frowand.list@gmail.com>,
	devicetree@vger.kernel.org
Subject: Re: [PATCH] of: module: prevent NULL pointer dereference in vsnprintf()
Date: Wed, 27 Mar 2024 17:04:31 -0500	[thread overview]
Message-ID: <171157706952.177016.3566396296616071267.robh@kernel.org> (raw)
In-Reply-To: <1d211023-3923-685b-20f0-f3f90ea56e1f@omp.ru>


On Wed, 27 Mar 2024 19:52:49 +0300, Sergey Shtylyov wrote:
> In of_modalias(), we can get passed the str and len parameters which would
> cause a kernel oops in vsnprintf() since it only allows passing a NULL ptr
> when the length is also 0. Also, we need to filter out the negative values
> of the len parameter as these will result in a really huge buffer since
> snprintf() takes size_t parameter while ours is ssize_t...
> 
> Found by Linux Verification Center (linuxtesting.org) with the Svace static
> analysis tool.
> 
> Signed-off-by: Sergey Shtylyov <s.shtylyov@omp.ru>
> 
> ---
> The patch is against the for-next branch of Rob Herring's linux-git repo...
> 
>  drivers/of/module.c |    8 ++++++++
>  1 file changed, 8 insertions(+)
> 

Applied, thanks!


      parent reply	other threads:[~2024-03-27 22:04 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-03-27 16:52 [PATCH] of: module: prevent NULL pointer dereference in vsnprintf() Sergey Shtylyov
2024-03-27 22:04 ` Saravana Kannan
2024-03-27 22:04 ` 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=171157706952.177016.3566396296616071267.robh@kernel.org \
    --to=robh@kernel.org \
    --cc=devicetree@vger.kernel.org \
    --cc=frowand.list@gmail.com \
    --cc=lvc-project@linuxtesting.org \
    --cc=robh+dt@kernel.org \
    --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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox