[PATCH v2 1/2] string: add mem_is_zero() helper to check if memory area is all zeros

Kees Cook kees at kernel.org
Thu Aug 15 16:07:01 UTC 2024


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 at intel.com>

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

-- 
Kees Cook


More information about the dri-devel mailing list