linux-raid.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: NeilBrown <neilb@suse.de>
To: Justin Maggard <jmaggard10@gmail.com>
Cc: linux-raid@vger.kernel.org
Subject: Re: [PATCH] Grow: fix resize of array component size to > 32bits
Date: Wed, 29 Oct 2014 09:19:57 +1100	[thread overview]
Message-ID: <20141029091957.1c4cdeae@notabene.brown> (raw)
In-Reply-To: <1414198502-10167-1-git-send-email-jmaggard10@gmail.com>

[-- Attachment #1: Type: text/plain, Size: 1118 bytes --]

On Fri, 24 Oct 2014 17:55:02 -0700 Justin Maggard <jmaggard10@gmail.com>
wrote:

> If the request --size to --grow an array to is larger
> than 32bits, then mdadm may make the wrong choice and
> use ioctl instead of setting component_size via sysfs
> and the change is ignored.

Can you explain exactly why the  current code is not sufficient?  When does
it fail?
If you include the explanation in a re-submission of the patch, and I am
convinced, then I will gladly apply your patch.

Thanks,
NeilBrown

> 
> Instead of using casts to check for a 32-bit overflow,
> just check for set bits outside of INT32_MAX.
> ---
>  Grow.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/Grow.c b/Grow.c
> index a9c8589..a614102 100644
> --- a/Grow.c
> +++ b/Grow.c
> @@ -1818,7 +1818,7 @@ int Grow_reshape(char *devname, int fd,
>  		if (s->size == MAX_SIZE)
>  			s->size = 0;
>  		array.size = s->size;
> -		if (array.size != (signed)s->size) {
> +		if (s->size & ~INT32_MAX) {
>  			/* got truncated to 32bit, write to
>  			 * component_size instead
>  			 */


[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 828 bytes --]

  reply	other threads:[~2014-10-28 22:19 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-10-25  0:55 [PATCH] Grow: fix resize of array component size to > 32bits Justin Maggard
2014-10-28 22:19 ` NeilBrown [this message]
2014-10-28 23:47   ` Justin Maggard
2014-10-29  0:05     ` NeilBrown

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=20141029091957.1c4cdeae@notabene.brown \
    --to=neilb@suse.de \
    --cc=jmaggard10@gmail.com \
    --cc=linux-raid@vger.kernel.org \
    /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).