All of lore.kernel.org
 help / color / mirror / Atom feed
From: zkabelac@sourceware.org <zkabelac@sourceware.org>
To: lvm-devel@redhat.com
Subject: LVM2 ./WHATS_NEW lib/log/log.c
Date: 22 Oct 2011 16:52:01 -0000	[thread overview]
Message-ID: <20111022165201.10791.qmail@sourceware.org> (raw)

CVSROOT:	/cvs/lvm2
Module name:	LVM2
Changes by:	zkabelac at sourceware.org	2011-10-22 16:52:01

Modified files:
	.              : WHATS_NEW 
	lib/log        : log.c 

Log message:
	Reduce stack size usage in print_log
	
	As the buf2[] and locn[] can't be used at the same time, safe 1 page from
	stack memory.

Patches:
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/WHATS_NEW.diff?cvsroot=lvm2&r1=1.2167&r2=1.2168
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/lib/log/log.c.diff?cvsroot=lvm2&r1=1.65&r2=1.66

--- LVM2/WHATS_NEW	2011/10/22 16:42:10	1.2167
+++ LVM2/WHATS_NEW	2011/10/22 16:52:00	1.2168
@@ -1,5 +1,6 @@
 Version 2.02.89 - 
 ==================================
+  Remove extra 4kB buffer allocated on stack in print_log().
   Make move_lv_segment non-static function and use dm_list function.
   Pass exclusive LV locks to all nodes in the cluster.
   Improve lvcreate man documentation of the chunksize option.
--- LVM2/lib/log/log.c	2011/08/11 19:21:42	1.65
+++ LVM2/lib/log/log.c	2011/10/22 16:52:00	1.66
@@ -185,7 +185,7 @@
 	       const char *format, ...)
 {
 	va_list ap;
-	char buf[1024], buf2[4096], locn[4096];
+	char buf[1024], locn[4096];
 	int bufused, n;
 	const char *message;
 	const char *trformat;		/* Translated format string */
@@ -221,7 +221,7 @@
 	    (_store_errmsg && (level <= _LOG_ERR)) ||
 	    log_once) {
 		va_start(ap, format);
-		n = vsnprintf(buf2, sizeof(buf2) - 1, trformat, ap);
+		n = vsnprintf(locn, sizeof(locn) - 1, trformat, ap);
 		va_end(ap);
 
 		if (n < 0) {
@@ -230,8 +230,8 @@
 			goto log_it;
 		}
 
-		buf2[sizeof(buf2) - 1] = '\0';
-		message = &buf2[0];
+		locn[sizeof(locn) - 1] = '\0';
+		message = &locn[0];
 	}
 
 /* FIXME Avoid pointless use of message buffer when it'll never be read! */



             reply	other threads:[~2011-10-22 16:52 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-10-22 16:52 zkabelac [this message]
  -- strict thread matches above, loose matches on Subject: below --
2012-02-08 11:31 LVM2 ./WHATS_NEW lib/log/log.c zkabelac
2008-06-17 14:14 wysochanski
2008-04-07 13:53 mbroz

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20111022165201.10791.qmail@sourceware.org \
    --to=zkabelac@sourceware.org \
    --cc=lvm-devel@redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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.