All of lore.kernel.org
 help / color / mirror / Atom feed
* + core_pattern-fix-long-parameters-was-truncated-by-core_pattern-handler-update-2.patch added to -mm tree
@ 2010-08-25 19:23 akpm
  0 siblings, 0 replies; only message in thread
From: akpm @ 2010-08-25 19:23 UTC (permalink / raw)
  To: mm-commits; +Cc: dfeng, akpm, kosaki.motohiro, nhorman, oleg, roland, viro


The patch titled
     core_pattern-fix-long-parameters-was-truncated-by-core_pattern-handler-update-2
has been added to the -mm tree.  Its filename is
     core_pattern-fix-long-parameters-was-truncated-by-core_pattern-handler-update-2.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/SubmitChecklist when testing your code ***

See http://userweb.kernel.org/~akpm/stuff/added-to-mm.txt to find
out what to do about this

The current -mm tree may be found at http://userweb.kernel.org/~akpm/mmotm/

------------------------------------------------------
Subject: core_pattern-fix-long-parameters-was-truncated-by-core_pattern-handler-update-2
From: Xiaotian Feng <dfeng@redhat.com>

Changes since v4:
cn_printf needs to take trailing '\0' into account. Then we don't need to
copy extra '\0' while parsing pat_ptr.

Signed-off-by: Xiaotian Feng <dfeng@redhat.com>
Cc: Alexander Viro <viro@zeniv.linux.org.uk>
Cc: Andrew Morton <akpm@linux-foundation.org>
Cc: Oleg Nesterov <oleg@redhat.com>
Cc: KOSAKI Motohiro <kosaki.motohiro@jp.fujitsu.com>
Cc: Neil Horman <nhorman@tuxdriver.com>
Cc: Roland McGrath <roland@redhat.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
---

 fs/exec.c |    7 +++----
 1 file changed, 3 insertions(+), 4 deletions(-)

diff -puN fs/exec.c~core_pattern-fix-long-parameters-was-truncated-by-core_pattern-handler-update-2 fs/exec.c
--- a/fs/exec.c~core_pattern-fix-long-parameters-was-truncated-by-core_pattern-handler-update-2
+++ a/fs/exec.c
@@ -1477,7 +1477,7 @@ static int cn_printf(struct core_name *c
 	need = vsnprintf(NULL, 0, fmt, arg);
 	va_end(arg);
 
-	if (likely(need < cn->size - cn->used))
+	if (likely(need < cn->size - cn->used -1))
 		goto out_printf;
 
 	ret = expand_corename(cn);
@@ -1519,14 +1519,13 @@ static int format_corename(struct core_n
 	   space */
 	while (*pat_ptr) {
 		if (*pat_ptr != '%') {
+			if (*pat_ptr == 0)
+				goto out;
 			err = cn_printf(cn, "%c", *pat_ptr++);
 		} else {
 			switch (*++pat_ptr) {
 			/* single % at the end, drop that */
 			case 0:
-				err = cn_printf(cn, "%c", '\0');
-				if (err)
-					break;
 				goto out;
 			/* Double percent, output one percent */
 			case '%':
_

Patches currently in -mm which might be from dfeng@redhat.com are

linux-next.patch
core_pattern-fix-long-parameters-was-truncated-by-core_pattern-handler.patch
core_pattern-fix-long-parameters-was-truncated-by-core_pattern-handler-update.patch
core_pattern-fix-long-parameters-was-truncated-by-core_pattern-handler-update-2.patch


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

only message in thread, other threads:[~2010-08-25 19:23 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-08-25 19:23 + core_pattern-fix-long-parameters-was-truncated-by-core_pattern-handler-update-2.patch added to -mm tree akpm

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.