From: David Laight <david.laight.linux@gmail.com>
To: Biancaa Ramesh <biancaa2210329@ssn.edu.in>
Cc: linux-kernel@vger.kernel.org
Subject: Re: [PATCH] replace strcpy with strscpy for safe copy
Date: Fri, 24 Oct 2025 09:37:09 +0100 [thread overview]
Message-ID: <20251024093709.5115f8b0@pumpkin> (raw)
In-Reply-To: <20251021145700.38374-1-biancaa2210329@ssn.edu.in>
On Tue, 21 Oct 2025 20:27:00 +0530
Biancaa Ramesh <biancaa2210329@ssn.edu.in> wrote:
A complete pile of bollocks....
> Signed-off-by: Biancaa Ramesh <biancaa2210329@ssn.edu.in>
> ---
> mm/shmem.c | 23 ++++++++++++-----------
> 1 file changed, 12 insertions(+), 11 deletions(-)
>
> diff --git a/mm/shmem.c b/mm/shmem.c
> index b9081b817d28..6e5a5d6fc7e9 100644
> --- a/mm/shmem.c
> +++ b/mm/shmem.c
> @@ -657,17 +657,18 @@ static int shmem_parse_huge(const char *str)
> if (!str)
> return -EINVAL;
>
> - if (!strcmp(str, "never"))
> + if (!strncmp(str,"never",strlen("never")+1)){
> huge = SHMEM_HUGE_NEVER;
> - else if (!strcmp(str, "always"))
> + }
> + else if (!strncmp(str, "always", strlen("always") + 1))
> huge = SHMEM_HUGE_ALWAYS;
> - else if (!strcmp(str, "within_size"))
> + else if (!strncmp(str, "within_size",strlen("Within_size")+1))
> huge = SHMEM_HUGE_WITHIN_SIZE;
> - else if (!strcmp(str, "advise"))
> + else if (!strncmp(str,"advise",strlen("advise")+1))
> huge = SHMEM_HUGE_ADVISE;
> - else if (!strcmp(str, "deny"))
> + else if (!strncmp(str,"deny",strlen("deny")+1))
> huge = SHMEM_HUGE_DENY;
> - else if (!strcmp(str, "force"))
> + else if (!strncmp(str,"force",strlen("force")+1))
> huge = SHMEM_HUGE_FORCE;
> else
> return -EINVAL;
> @@ -5679,27 +5680,27 @@ static int __init setup_thp_shmem(char *str)
> goto err;
>
> nr = end - start + 1;
> - if (!strcmp(policy, "always")) {
> + if (!strncmp(policy,"always",strlen("always")+1)){
> bitmap_set(&always, start, nr);
> bitmap_clear(&inherit, start, nr);
> bitmap_clear(&madvise, start, nr);
> bitmap_clear(&within_size, start, nr);
> - } else if (!strcmp(policy, "advise")) {
> + } else if (!strncmp(policy,"advise",strlen("advise")+1)){
> bitmap_set(&madvise, start, nr);
> bitmap_clear(&inherit, start, nr);
> bitmap_clear(&always, start, nr);
> bitmap_clear(&within_size, start, nr);
> - } else if (!strcmp(policy, "inherit")) {
> + } else if (!strncmp(policy,"inherit",strlen("inherit")+1)){
> bitmap_set(&inherit, start, nr);
> bitmap_clear(&madvise, start, nr);
> bitmap_clear(&always, start, nr);
> bitmap_clear(&within_size, start, nr);
> - } else if (!strcmp(policy, "within_size")) {
> + } else if (!strncmp(policy,"within_size",strlen("within_size")+1)){
> bitmap_set(&within_size, start, nr);
> bitmap_clear(&inherit, start, nr);
> bitmap_clear(&madvise, start, nr);
> bitmap_clear(&always, start, nr);
> - } else if (!strcmp(policy, "never")) {
> + } else if (!strncmp(policy,"never",strlen("never")+1)){
> bitmap_clear(&inherit, start, nr);
> bitmap_clear(&madvise, start, nr);
> bitmap_clear(&always, start, nr);
next prev parent reply other threads:[~2025-10-24 8:37 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-10-21 14:57 [PATCH] replace strcpy with strscpy for safe copy Biancaa Ramesh
2025-10-24 0:55 ` Barry Song
2025-10-24 8:37 ` David Laight [this message]
-- strict thread matches above, loose matches on Subject: below --
2025-10-21 14:39 Biancaa Ramesh
2025-10-22 19:23 ` Al Viro
2025-10-23 8:20 ` David Laight
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=20251024093709.5115f8b0@pumpkin \
--to=david.laight.linux@gmail.com \
--cc=biancaa2210329@ssn.edu.in \
--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