This is a note to let you know that I've just added the patch titled MIPS: Malta: Improve system memory detection for '{e, }memsize' >= 2G to the 3.16-stable tree which can be found at: http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary The filename of the patch is: mips-malta-improve-system-memory-detection-for-e-memsize-2g.patch and it can be found in the queue-3.16 subdirectory. If you, or anyone else, feels it should not be added to the stable tree, please let <stable@xxxxxxxxxxxxxxx> know about it. >From 64615682658373516863b5b5971ff1d922d0ae7b Mon Sep 17 00:00:00 2001 From: Markos Chandras <markos.chandras@xxxxxxxxxx> Date: Mon, 18 Aug 2014 15:04:11 +0100 Subject: MIPS: Malta: Improve system memory detection for '{e, }memsize' >= 2G From: Markos Chandras <markos.chandras@xxxxxxxxxx> commit 64615682658373516863b5b5971ff1d922d0ae7b upstream. Using kstrtol to parse the "{e,}memsize" variables was wrong because this parses signed long numbers. In case of '{e,}memsize' >= 2G, the top bit is set, resulting to -ERANGE errors and possibly random system memory boundaries. We fix this by replacing "kstrtol" with "kstrtoul". We also improve the code to check the kstrtoul return value and print a warning if an error was returned. Signed-off-by: Markos Chandras <markos.chandras@xxxxxxxxxx> Cc: linux-mips@xxxxxxxxxxxxxx Patchwork: https://patchwork.linux-mips.org/patch/7543/ Signed-off-by: Ralf Baechle <ralf@xxxxxxxxxxxxxx> Signed-off-by: Greg Kroah-Hartman <gregkh@xxxxxxxxxxxxxxxxxxx> --- arch/mips/mti-malta/malta-memory.c | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) --- a/arch/mips/mti-malta/malta-memory.c +++ b/arch/mips/mti-malta/malta-memory.c @@ -34,13 +34,19 @@ fw_memblock_t * __init fw_getmdesc(int e /* otherwise look in the environment */ memsize_str = fw_getenv("memsize"); - if (memsize_str) - tmp = kstrtol(memsize_str, 0, &memsize); + if (memsize_str) { + tmp = kstrtoul(memsize_str, 0, &memsize); + if (tmp) + pr_warn("Failed to read the 'memsize' env variable.\n"); + } if (eva) { /* Look for ememsize for EVA */ ememsize_str = fw_getenv("ememsize"); - if (ememsize_str) - tmp = kstrtol(ememsize_str, 0, &ememsize); + if (ememsize_str) { + tmp = kstrtoul(ememsize_str, 0, &ememsize); + if (tmp) + pr_warn("Failed to read the 'ememsize' env variable.\n"); + } } if (!memsize && !ememsize) { pr_warn("memsize not set in YAMON, set to default (32Mb)\n"); Patches currently in stable-queue which might be from markos.chandras@xxxxxxxxxx are queue-3.16/mips-smp-mt-fix-link-error-when-proc_fs-n.patch queue-3.16/mips-malta-improve-system-memory-detection-for-e-memsize-2g.patch queue-3.16/mips-malta-eva-rename-eva_entry-to-platform_eva_init.patch queue-3.16/mips-syscall-fix-audit-value-for-o32-processes-on-mips64.patch queue-3.16/mips-eva-add-new-eva-header.patch queue-3.16/mips-cps-initialize-eva-before-bringing-up-vpes-from-secondary-cores.patch queue-3.16/mips-scall64-o32-fix-indirect-syscall-detection.patch queue-3.16/mips-octeon-make-get_system_type-thread-safe.patch queue-3.16/mips-gic-prevent-array-overrun.patch -- To unsubscribe from this list: send the line "unsubscribe stable" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html