Re: [PATCH] fix: Monitor sometimes crashes

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Wed, 11 Jan 2012 11:04:08 +0100 Lukasz Dorau <lukasz.dorau@xxxxxxxxx>
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@xxxxxxxxx>
> ---
>  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: signature.asc
Description: PGP signature


[Index of Archives]     [Linux RAID Wiki]     [ATA RAID]     [Linux SCSI Target Infrastructure]     [Linux Block]     [Linux IDE]     [Linux SCSI]     [Linux Hams]     [Device Mapper]     [Device Mapper Cryptographics]     [Kernel]     [Linux Admin]     [Linux Net]     [GFS]     [RPM]     [git]     [Yosemite Forum]


  Powered by Linux