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@xxxxxxxxxx> 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@xxxxxxxxxx> Cc: Alexander Viro <viro@xxxxxxxxxxxxxxxxxx> Cc: Andrew Morton <akpm@xxxxxxxxxxxxxxxxxxxx> Cc: Oleg Nesterov <oleg@xxxxxxxxxx> Cc: KOSAKI Motohiro <kosaki.motohiro@xxxxxxxxxxxxxx> Cc: Neil Horman <nhorman@xxxxxxxxxxxxx> Cc: Roland McGrath <roland@xxxxxxxxxx> Signed-off-by: Andrew Morton <akpm@xxxxxxxxxxxxxxxxxxxx> --- 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@xxxxxxxxxx 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 -- 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