+ mm-vmpressure-use-kstrndup-instead-of-kmallocstrncpy.patch added to -mm tree

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



The patch titled
     Subject: mm/vmpressure.c: use kstrndup instead of kmalloc+strncpy
has been added to the -mm tree.  Its filename is
     mm-vmpressure-use-kstrndup-instead-of-kmallocstrncpy.patch

This patch should soon appear at
    http://ozlabs.org/~akpm/mmots/broken-out/mm-vmpressure-use-kstrndup-instead-of-kmallocstrncpy.patch
and later at
    http://ozlabs.org/~akpm/mmotm/broken-out/mm-vmpressure-use-kstrndup-instead-of-kmallocstrncpy.patch

Before you just go and hit "reply", please:
   a) Consider who else should be cc'ed
   b) Prefer to cc a suitable mailing list as well
   c) Ideally: find the original patch on the mailing list and do a
      reply-to-all to that, adding suitable additional cc's

*** Remember to use Documentation/process/submit-checklist.rst when testing your code ***

The -mm tree is included into linux-next and is updated
there every 3-4 working days

------------------------------------------------------
From: Andy Shevchenko <andriy.shevchenko@xxxxxxxxxxxxxxx>
Subject: mm/vmpressure.c: use kstrndup instead of kmalloc+strncpy

Using kstrndup() simplifies the code.

Link: http://lkml.kernel.org/r/20180503201807.24941-1-andriy.shevchenko@xxxxxxxxxxxxxxx
Signed-off-by: Andy Shevchenko <andriy.shevchenko@xxxxxxxxxxxxxxx>
Acked-by: Michal Hocko <mhocko@xxxxxxxx>
Cc: David Rientjes <rientjes@xxxxxxxxxx>
Signed-off-by: Andrew Morton <akpm@xxxxxxxxxxxxxxxxxxxx>
---

 mm/vmpressure.c |    3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff -puN mm/vmpressure.c~mm-vmpressure-use-kstrndup-instead-of-kmallocstrncpy mm/vmpressure.c
--- a/mm/vmpressure.c~mm-vmpressure-use-kstrndup-instead-of-kmallocstrncpy
+++ a/mm/vmpressure.c
@@ -390,12 +390,11 @@ int vmpressure_register_event(struct mem
 	char *token;
 	int ret = 0;
 
-	spec_orig = spec = kzalloc(MAX_VMPRESSURE_ARGS_LEN + 1, GFP_KERNEL);
+	spec_orig = spec = kstrndup(args, MAX_VMPRESSURE_ARGS_LEN, GFP_KERNEL);
 	if (!spec) {
 		ret = -ENOMEM;
 		goto out;
 	}
-	strncpy(spec, args, MAX_VMPRESSURE_ARGS_LEN);
 
 	/* Find required level */
 	token = strsep(&spec, ",");
_

Patches currently in -mm which might be from andriy.shevchenko@xxxxxxxxxxxxxxx are

mm-vmpressure-use-kstrndup-instead-of-kmallocstrncpy.patch
mm-vmpressure-convert-to-use-match_string-helper.patch

--
To unsubscribe from this list: send the line "unsubscribe mm-commits" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html



[Index of Archives]     [Kernel Archive]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]

  Powered by Linux