mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
To: Kees Cook <keescook@chromium.org>
Cc: "Hans de Goede" <hdegoede@redhat.com>,
	"Mark Gross" <mgross@linux.intel.com>,
	"Mario Limonciello" <mario.limonciello@dell.com>,
	"Pali Rohár" <pali@kernel.org>,
	"Uwe Kleine-König" <u.kleine-koenig@pengutronix.de>,
	Dell.Client.Kernel@dell.com, platform-driver-x86@vger.kernel.org,
	"Andy Lavr" <andy.lavr@gmail.com>,
	linux-kernel@vger.kernel.org, linux-hardening@vger.kernel.org
Subject: Re: [PATCH][RFC] platform/x86: dell-smbios-wmi: Avoid false-positive memcpy() warning
Date: Wed, 25 Aug 2021 19:32:29 +0300	[thread overview]
Message-ID: <YSZwnXqIaIo+hG37@smile.fi.intel.com> (raw)
In-Reply-To: <20210825160749.3891090-1-keescook@chromium.org>

On Wed, Aug 25, 2021 at 09:07:49AM -0700, Kees Cook wrote:
> In preparation for FORTIFY_SOURCE performing compile-time and run-time
> field bounds checking for memcpy(), memmove(), and memset(), avoid
> intentionally writing across neighboring fields.
> 
> Since all the size checking has already happened, use input.pointer
> (void *) so memcpy() doesn't get confused about how much is being
> written.
> 
> Avoids this false-positive warning when run-time memcpy() strict
> bounds checking is enabled:
> 
> memcpy: detected field-spanning write (size 4096) of single field (size 36)
> WARNING: CPU: 0 PID: 357 at drivers/platform/x86/dell/dell-smbios-wmi.c:74 run_smbios_call+0x110/0x1e0 [dell_smbios]

> Note: is there a missed kfree() in the marked error path?

Seems so.

* Note: The caller should use acpi_os_free to free this
* buffer created via ACPI_ALLOCATE_BUFFER.


-- 
With Best Regards,
Andy Shevchenko



  reply	other threads:[~2021-08-25 16:32 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-08-25 16:07 Kees Cook
2021-08-25 16:32 ` Andy Shevchenko [this message]
2021-08-26 13:57 ` Hans de Goede

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=YSZwnXqIaIo+hG37@smile.fi.intel.com \
    --to=andriy.shevchenko@linux.intel.com \
    --cc=Dell.Client.Kernel@dell.com \
    --cc=andy.lavr@gmail.com \
    --cc=hdegoede@redhat.com \
    --cc=keescook@chromium.org \
    --cc=linux-hardening@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mario.limonciello@dell.com \
    --cc=mgross@linux.intel.com \
    --cc=pali@kernel.org \
    --cc=platform-driver-x86@vger.kernel.org \
    --cc=u.kleine-koenig@pengutronix.de \
    /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

all inboxes | Powered by JetHome®