lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20150206111907.6768ab49@gandalf.local.home>
Date:	Fri, 6 Feb 2015 11:19:07 -0500
From:	Steven Rostedt <rostedt@...dmis.org>
To:	Al Viro <viro@...IV.linux.org.uk>
Cc:	linux-kernel@...r.kernel.org
Subject: Re: [RFC][PATCH v2 2/7] implement memmem()

On Fri,  6 Feb 2015 04:00:10 +0000
Al Viro <viro@...IV.linux.org.uk> wrote:

> From: Al Viro <viro@...iv.linux.org.uk>
> 
> Signed-off-by: Al Viro <viro@...iv.linux.org.uk>
> ---
>  include/linux/string.h |  1 +
>  lib/string.c           | 34 ++++++++++++++++++++++------------
>  2 files changed, 23 insertions(+), 12 deletions(-)
> 
> diff --git a/include/linux/string.h b/include/linux/string.h
> index 2e22a2e..87f9fba 100644
> --- a/include/linux/string.h
> +++ b/include/linux/string.h
> @@ -75,6 +75,7 @@ extern char * strstr(const char *, const char *);
>  #endif
>  #ifndef __HAVE_ARCH_STRNSTR
>  extern char * strnstr(const char *, const char *, size_t);
> +extern void * memmem(const void *, size_t, const void *, size_t);
>  #endif
>  #ifndef __HAVE_ARCH_STRLEN
>  extern __kernel_size_t strlen(const char *);
> diff --git a/lib/string.c b/lib/string.c
> index 1006330..2035dbe 100644
> --- a/lib/string.c
> +++ b/lib/string.c
> @@ -740,27 +740,37 @@ EXPORT_SYMBOL(strstr);
>  #endif
>  
>  #ifndef __HAVE_ARCH_STRNSTR

Although I do not see any archs that have this set, if one were to set
it, then memmem() would also have to be implemented.

Should this patch add a:

#ifndef __HAVE_ARCH_MEMMEM

?

-- Steve

> +
>  /**
> - * strnstr - Find the first substring in a length-limited string
> + * memmem - Find the first length-limited substring in a length-limited string
>   * @s1: The string to be searched
> + * @len1: the maximum number of characters to search
>   * @s2: The string to search for
> - * @len: the maximum number of characters to search
> + * @len2: the length of the string being searched
>   */
> -char *strnstr(const char *s1, const char *s2, size_t len)
> +void *memmem(const void *s1, size_t len1, const void *s2, size_t len2)
>  {
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ