linux-raid.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Jes Sorensen <Jes.Sorensen@redhat.com>
To: Xiao Ni <xni@redhat.com>
Cc: linux-raid@vger.kernel.org, Deepa Dinamani <deepa.kernel@gmail.com>
Subject: Re: [mdadm PATCH 1/1] Fix some type comparison problems
Date: Wed, 03 Feb 2016 15:36:25 -0500	[thread overview]
Message-ID: <wrfjr3gth6pi.fsf@redhat.com> (raw)
In-Reply-To: <1454477089-8166-1-git-send-email-xni@redhat.com> (Xiao Ni's message of "Wed, 3 Feb 2016 13:24:49 +0800")

Xiao Ni <xni@redhat.com> writes:
> It complains when building on s390 and i686 platform.
>
> Signed-off-by : Xiao Ni <xni@redhat.com>
> ---
>  Monitor.c | 2 +-
>  util.c    | 2 +-
>  2 files changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/Monitor.c b/Monitor.c
> index f19c2e5..928aa45 100644
> --- a/Monitor.c
> +++ b/Monitor.c
> @@ -542,7 +542,7 @@ static int check_array(struct state *st, struct mdstat_ent *mdstat,
>  		alert("NewArray", st->devname, NULL, ainfo);
>  	}
>  
> -	if (st->utime == array.utime &&
> +	if (st->utime == (long)array.utime &&
>  	    st->failed == array.failed_disks &&
>  	    st->working == array.working_disks &&
>  	    st->spare == array.spare_disks &&

Hi Xiao,

Thanks for the patch - I think the correct fix in Monitor.c is to change
utime in struct state from long to unsigned int, to match the change
Deepa Dinamani introduced in 26714713cd2bad9e0bf7f4669f6cc4659ceaab6c
utime is only ever derived from mdu_array_info_s, so it should be safe.

> diff --git a/util.c b/util.c
> index 970d484..ccbb2bc 100644
> --- a/util.c
> +++ b/util.c
> @@ -1288,7 +1288,7 @@ struct supertype *guess_super_type(int fd, enum guess_types guess_type)
>  			struct mdinfo info;
>  			st->ss->getinfo_super(st, &info, NULL);
>  			if (bestsuper == -1 ||
> -			    besttime < info.array.ctime) {
> +			    besttime < (time_t)info.array.ctime) {
>  				bestsuper = i;
>  				besttime = info.array.ctime;
>  			}

Here I think we should change the declaration of besttime from time_t to
unsigned int, again to match the definition used in mdu_array_info_s.

That or we should change mdu_array_info_s to use time_t instead, but I
am not sure that would be safe.

Cheers,
Jes

  reply	other threads:[~2016-02-03 20:36 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-02-03  5:24 [mdadm PATCH 1/1] Fix some type comparison problems Xiao Ni
2016-02-03 20:36 ` Jes Sorensen [this message]
2016-02-04  3:10   ` Deepa Dinamani
  -- strict thread matches above, loose matches on Subject: below --
2016-02-04 12:26 Xiao Ni
2016-02-04 13:12 ` Jes Sorensen
2016-02-06  1:18 Xiao Ni
2016-02-08 15:51 ` Jes Sorensen

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=wrfjr3gth6pi.fsf@redhat.com \
    --to=jes.sorensen@redhat.com \
    --cc=deepa.kernel@gmail.com \
    --cc=linux-raid@vger.kernel.org \
    --cc=xni@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 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).