From: NeilBrown <neilb@suse.de>
To: Lukasz Dorau <lukasz.dorau@intel.com>
Cc: linux-raid@vger.kernel.org, dan.j.williams@intel.com,
marcin.labun@intel.com, ed.ciechanowski@intel.com
Subject: Re: [PATCH] fix: Monitor sometimes crashes
Date: Thu, 12 Jan 2012 10:40:34 +1100 [thread overview]
Message-ID: <20120112104034.15168a26@notabene.brown> (raw)
In-Reply-To: <20120111100408.686.15194.stgit@gklab-128-085.igk.intel.com>
[-- Attachment #1: Type: text/plain, Size: 1062 bytes --]
On Wed, 11 Jan 2012 11:04:08 +0100 Lukasz Dorau <lukasz.dorau@intel.com>
wrote:
> The "char cnt [40]" buffer is sometimes too small to hold all message
> - in such case monitor crashes.
> The buffer must be larger to be able to hold all message.
>
> Signed-off-by: Lukasz Dorau <lukasz.dorau@intel.com>
> ---
> Monitor.c | 2 +-
> 1 files changed, 1 insertions(+), 1 deletions(-)
>
> diff --git a/Monitor.c b/Monitor.c
> index 8bc8824..4352a0d 100644
> --- a/Monitor.c
> +++ b/Monitor.c
> @@ -563,7 +563,7 @@ static int check_array(struct state *st, struct mdstat_ent *mdstat,
> struct mdinfo *sra =
> sysfs_read(-1, st->devnum, GET_MISMATCH);
> if (sra && sra->mismatch_cnt > 0) {
> - char cnt[40];
> + char cnt[44];
> sprintf(cnt, " mismatches found: %d (on raid level %d)",
> sra->mismatch_cnt, array.level);
> alert("RebuildFinished", dev, cnt, ainfo);
Applied, thanks.
Plus I changed it to "snprintf" and made the 'cnt' even larger.
Should probably use asprintf there...
Thanks,
NeilBrown
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 828 bytes --]
prev parent reply other threads:[~2012-01-11 23:40 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-01-11 10:04 [PATCH] fix: Monitor sometimes crashes Lukasz Dorau
2012-01-11 23:40 ` NeilBrown [this message]
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=20120112104034.15168a26@notabene.brown \
--to=neilb@suse.de \
--cc=dan.j.williams@intel.com \
--cc=ed.ciechanowski@intel.com \
--cc=linux-raid@vger.kernel.org \
--cc=lukasz.dorau@intel.com \
--cc=marcin.labun@intel.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).