public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Kees Cook <kees@kernel.org>
To: Jani Nikula <jani.nikula@intel.com>
Cc: linux-kernel@vger.kernel.org, dri-devel@lists.freedesktop.org,
	intel-gfx@lists.freedesktop.org,
	Andy Shevchenko <andy@kernel.org>
Subject: Re: [PATCH v2 1/2] string: add mem_is_zero() helper to check if memory area is all zeros
Date: Thu, 15 Aug 2024 09:07:01 -0700	[thread overview]
Message-ID: <202408150906.28A920F62@keescook> (raw)
In-Reply-To: <20240814100035.3100852-1-jani.nikula@intel.com>

On Wed, Aug 14, 2024 at 01:00:34PM +0300, Jani Nikula wrote:
> Almost two thirds of the memchr_inv() usages check if the memory area is
> all zeros, with no interest in where in the buffer the first non-zero
> byte is located. Checking for !memchr_inv(s, 0, n) is also not very
> intuitive or discoverable. Add an explicit mem_is_zero() helper for this
> use case.
> 
> Signed-off-by: Jani Nikula <jani.nikula@intel.com>

Reviewed-by: Kees Cook <kees@kernel.org>

-- 
Kees Cook

      parent reply	other threads:[~2024-08-15 16:07 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-08-14 10:00 [PATCH v2 1/2] string: add mem_is_zero() helper to check if memory area is all zeros Jani Nikula
2024-08-14 10:00 ` [PATCH v2 2/2] drm: use mem_is_zero() instead of !memchr_inv(s, 0, n) Jani Nikula
2024-08-15 16:07   ` Kees Cook
2024-08-16 13:12     ` Jani Nikula
2024-08-14 12:44 ` [PATCH v2 1/2] string: add mem_is_zero() helper to check if memory area is all zeros Andy Shevchenko
2024-08-15 16:07 ` Kees Cook [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=202408150906.28A920F62@keescook \
    --to=kees@kernel.org \
    --cc=andy@kernel.org \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=intel-gfx@lists.freedesktop.org \
    --cc=jani.nikula@intel.com \
    --cc=linux-kernel@vger.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