All of lore.kernel.org
 help / color / mirror / Atom feed
From: Jes Sorensen <jes@trained-monkey.org>
To: Wu Guanghao <wuguanghao3@huawei.com>, linux-raid@vger.kernel.org
Cc: liuzhiqiang26@huawei.com, linfeilong@huawei.com
Subject: Re: [PATCH]mdadm: fix coredump of mdadm --monitor -r
Date: Fri, 8 Oct 2021 06:01:15 -0400	[thread overview]
Message-ID: <a223ce17-66fb-690e-cba6-935122f4af88@trained-monkey.org> (raw)
In-Reply-To: <41edfa76-4327-7468-b861-1c1140ee9725@huawei.com>

On 8/16/21 3:24 AM, Wu Guanghao wrote:
> Hi,
> 
> The --monitor -r option requires a parameter, otherwise a null pointer will be manipulated
> when converting to integer data, and a coredump will appear.
> 
> # mdadm --monitor -r
> Segmentation fault (core dumped)
> 
> Signed-off-by: Wu Guanghao <wuguanghao3@huawei.com>
> ---
>  ReadMe.c | 6 +++---
>  1 file changed, 3 insertions(+), 3 deletions(-)

Something is fishy with your mail client as this didn't apply, but I
applied it manually.

This seems a reasonable fix, even though we have different usages of -r
they all require an argument. That said the whole argument parsing
handling could do with an overhaul.

Thanks,
Jes


> diff --git a/ReadMe.c b/ReadMe.c
> index 06b8f7e..070a164 100644
> --- a/ReadMe.c
> +++ b/ReadMe.c
> @@ -81,11 +81,11 @@ char Version[] = "mdadm - v" VERSION " - " VERS_DATE EXTRAVERSION "\n";
>   *     found, it is started.
>   */
> 
> -char short_options[]="-ABCDEFGIQhVXYWZ:vqbc:i:l:p:m:n:x:u:c:d:z:U:N:sarfRSow1tye:k:";
> +char short_options[]="-ABCDEFGIQhVXYWZ:vqbc:i:l:p:m:r:n:x:u:c:d:z:U:N:safRSow1tye:k";
>  char short_bitmap_options[]=
> -               "-ABCDEFGIQhVXYWZ:vqb:c:i:l:p:m:n:x:u:c:d:z:U:N:sarfRSow1tye:k:";
> +               "-ABCDEFGIQhVXYWZ:vqb:c:i:l:p:m:r:n:x:u:c:d:z:U:N:safRSow1tye:k";
>  char short_bitmap_auto_options[]=
> -               "-ABCDEFGIQhVXYWZ:vqb:c:i:l:p:m:n:x:u:c:d:z:U:N:sa:rfRSow1tye:k:";
> +               "-ABCDEFGIQhVXYWZ:vqb:c:i:l:p:m:r:n:x:u:c:d:z:U:N:sa:RSow1tye:k";
> 
>  struct option long_options[] = {
>      {"manage",    0, 0, ManageOpt},
> --
> 2.23.0
> 


      parent reply	other threads:[~2021-10-08 10:01 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-08-16  7:24 [PATCH]mdadm: fix coredump of mdadm --monitor -r Wu Guanghao
2021-08-19  8:21 ` Wu Guanghao
2021-08-19 11:44   ` Tkaczyk, Mariusz
2021-10-08 10:01 ` Jes Sorensen [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=a223ce17-66fb-690e-cba6-935122f4af88@trained-monkey.org \
    --to=jes@trained-monkey.org \
    --cc=linfeilong@huawei.com \
    --cc=linux-raid@vger.kernel.org \
    --cc=liuzhiqiang26@huawei.com \
    --cc=wuguanghao3@huawei.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.