Re: [PATCH V2] Fix NULL dereference in super_by_fd

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

 



Dear lixiaokeng,


Thank you for your patch. I found a few style issues.

Am 14.12.22 um 04:17 schrieb lixiaokeng:
When we create 100 partitions(major is 259 not 254) in a raid device,

Please add a space before the (.

mdadm may coredump:

Core was generated by `/usr/sbin/mdadm --detail --export /dev/md1p3'.
Program terminated with signal SIGSEGV, Segmentation fault.
#0  __strlen_sse2 ()
     at ../sysdeps/x86_64/multiarch/strlen-vec.S:126
126		movdqu	(%rax), %xmm4
(gdb) bt
#0  __strlen_sse2 ()
     at ../sysdeps/x86_64/multiarch/strlen-vec.S:126
#1  0x00007f1944659139 in __strcpy_chk (
     dest=dest@entry=0x55ea8d7c23ac "", src=0x0,
     destlen=destlen@entry=32) at strcpy_chk.c:28
#2  0x000055ea8d10b66d in strcpy (__src=<optimized out>,
     __dest=0x55ea8d7c23ac "")
     at /usr/include/bits/string_fortified.h:79
#3  super_by_fd (fd=fd@entry=3,
     subarrayp=subarrayp@entry=0x7ffe6a1dff08) at util.c:1289
#4  0x000055ea8d11b3a6 in Detail (
     dev=0x7ffe6a1e2f22 "/dev/md1p3", c=0x7ffe6a1e1700)
     at Detail.c:101
#5  0x000055ea8d101e61 in misc_list (c=<optimized out>,
     ss=<optimized out>, dump_directory=<optimized out>,
     ident=<optimized out>, devlist=<optimized out>)
     at mdadm.c:1959
#6  main (argc=<optimized out>, argv=<optimized out>)
     at mdadm.c:1629

Please do not wrap the pasted lines.

The direct cause is fd2devnm return NULL. Here add a check.

… returning NULL, so add a check.

Signed-off-by:Lixiaokeng<lixiaokeng@xxxxxxxxxx>
Signed-off-by:Wuguanghao<wuguanghao3@xxxxxxxxxx>

Please add a space after the colon, and before the <. Also, is Lixiaokeng your name, or could it be written Li Xiao Keng? Please use that format – `git config --global user.name "…"`.

    git commit --amend --author="Li Xiao Keng <lixiaokeng@xxxxxxxxxx>"

---

As this is the second iteration (version 2) of the patch, it’s common, that you add a note, what the difference between this and the previous versions are.

  mapfile.c | 4 ++++
  util.c    | 7 ++++++-
  2 files changed, 10 insertions(+), 1 deletion(-)

[…]


Kind regards,

Paul



[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