All of lore.kernel.org
 help / color / mirror / Atom feed
* + mm-cma-support-multiple-contiguous-ranges-if-requested-fix-2.patch added to mm-unstable branch
@ 2025-02-25  3:41 Andrew Morton
  0 siblings, 0 replies; only message in thread
From: Andrew Morton @ 2025-02-25  3:41 UTC (permalink / raw)
  To: mm-commits, ziy, fvdl, david, arnd, akpm


The patch titled
     Subject: mm, cma: use literal printf format string
has been added to the -mm mm-unstable branch.  Its filename is
     mm-cma-support-multiple-contiguous-ranges-if-requested-fix-2.patch

This patch will shortly appear at
     https://git.kernel.org/pub/scm/linux/kernel/git/akpm/25-new.git/tree/patches/mm-cma-support-multiple-contiguous-ranges-if-requested-fix-2.patch

This patch will later appear in the mm-unstable branch at
    git://git.kernel.org/pub/scm/linux/kernel/git/akpm/mm

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 via the mm-everything
branch at git://git.kernel.org/pub/scm/linux/kernel/git/akpm/mm
and is updated there every 2-3 working days

------------------------------------------------------
From: Arnd Bergmann <arnd@arndb.de>
Subject: mm, cma: use literal printf format string
Date: Mon, 24 Feb 2025 15:07:36 +0100

Using a variable string as a printf format can be a security issue that
clang warns about when extra warnings are enabled:

mm/cma.c:239:37: error: format string is not a string literal (potentially insecure) [-Werror,-Wformat-security]
  239 |                 snprintf(cma->name, CMA_MAX_NAME, name);
      |                                                   ^~~~

This one does not appear to be a security issue since the string is
not user controlled, but it's better to avoid the warning.
Use "%s" as the format instead and just pass the name as the argument.

Link: https://lkml.kernel.org/r/20250224141120.1240534-2-arnd@kernel.org
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Reviewed-by: Zi Yan <ziy@nvidia.com>
Acked-by: David Hildenbrand <david@redhat.com>
Reviewed-by: Frank van der Linden <fvdl@google.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
---

 mm/cma.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

--- a/mm/cma.c~mm-cma-support-multiple-contiguous-ranges-if-requested-fix-2
+++ a/mm/cma.c
@@ -199,7 +199,7 @@ static int __init cma_new_area(const cha
 	cma_area_count++;
 
 	if (name)
-		snprintf(cma->name, CMA_MAX_NAME, name);
+		snprintf(cma->name, CMA_MAX_NAME, "%s", name);
 	else
 		snprintf(cma->name, CMA_MAX_NAME,  "cma%d\n", cma_area_count);
 
_

Patches currently in -mm which might be from arnd@arndb.de are

mm-cma-support-multiple-contiguous-ranges-if-requested-fix.patch
mm-cma-support-multiple-contiguous-ranges-if-requested-fix-2.patch
reboot-add-support-for-configuring-emergency-hardware-protection-action-fix.patch


^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2025-02-25  3:41 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-02-25  3:41 + mm-cma-support-multiple-contiguous-ranges-if-requested-fix-2.patch added to mm-unstable branch Andrew Morton

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.