* [PATCH] fix: Monitor sometimes crashes
@ 2012-01-11 10:04 Lukasz Dorau
2012-01-11 23:40 ` NeilBrown
0 siblings, 1 reply; 2+ messages in thread
From: Lukasz Dorau @ 2012-01-11 10:04 UTC (permalink / raw)
To: neilb; +Cc: linux-raid, dan.j.williams, marcin.labun, ed.ciechanowski
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);
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH] fix: Monitor sometimes crashes
2012-01-11 10:04 [PATCH] fix: Monitor sometimes crashes Lukasz Dorau
@ 2012-01-11 23:40 ` NeilBrown
0 siblings, 0 replies; 2+ messages in thread
From: NeilBrown @ 2012-01-11 23:40 UTC (permalink / raw)
To: Lukasz Dorau; +Cc: linux-raid, dan.j.williams, marcin.labun, ed.ciechanowski
[-- 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 --]
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2012-01-11 23:40 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-01-11 10:04 [PATCH] fix: Monitor sometimes crashes Lukasz Dorau
2012-01-11 23:40 ` NeilBrown
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).