* mdadm:compiled warning in mdadm.c:1974:29 treats as errors
@ 2017-04-04 5:31 Zhilong
2017-04-05 15:37 ` jes.sorensen
0 siblings, 1 reply; 9+ messages in thread
From: Zhilong @ 2017-04-04 5:31 UTC (permalink / raw)
To: Jes Sorensen; +Cc: linux-raid
Hi,jes;
I have found that there is mdfd returns uninitialized warning in mdadm.c. I cannot paste the logs due to I'm on holiday. Please try to issue make everything, you should see it.
Thanks,
-Zhilong
Send from iPhone
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: mdadm:compiled warning in mdadm.c:1974:29 treats as errors
2017-04-04 5:31 mdadm:compiled warning in mdadm.c:1974:29 treats as errors Zhilong
@ 2017-04-05 15:37 ` jes.sorensen
2017-04-06 8:21 ` Liu Zhilong
0 siblings, 1 reply; 9+ messages in thread
From: jes.sorensen @ 2017-04-05 15:37 UTC (permalink / raw)
To: Zhilong; +Cc: linux-raid
Zhilong <zlliu@suse.com> writes:
> Hi,jes;
> I have found that there is mdfd returns uninitialized warning in
> mdadm.c. I cannot paste the logs due to I'm on holiday. Please try to
> issue make everything, you should see it.
I don't see anything here, if you have specifics, please post them.
Jes
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: mdadm:compiled warning in mdadm.c:1974:29 treats as errors
2017-04-05 15:37 ` jes.sorensen
@ 2017-04-06 8:21 ` Liu Zhilong
2017-04-06 19:10 ` Jes Sorensen
0 siblings, 1 reply; 9+ messages in thread
From: Liu Zhilong @ 2017-04-06 8:21 UTC (permalink / raw)
To: jes.sorensen; +Cc: linux-raid
hi,
I found this compiling warning, and can reproduce on my Leap42.1,
Leap42.2 and SLES12 SP2 with v4.8.5 version of gcc.
# gcc -v
Using built-in specs.
COLLECT_GCC=gcc
COLLECT_LTO_WRAPPER=/usr/lib64/gcc/x86_64-suse-linux/4.8/lto-wrapper
Target: x86_64-suse-linux
Configured with: ../configure --prefix=/usr --infodir=/usr/share/info
--mandir=/usr/share/man --libdir=/usr/lib64 --libexecdir=/usr/lib64
--enable-languages=c,c++,objc,fortran,obj-c++,java,ada
--enable-checking=release --with-gxx-include-dir=/usr/include/c++/4.8
--enable-ssp --disable-libssp --disable-plugin
--with-bugurl=http://bugs.opensuse.org/ --with-pkgversion='SUSE Linux'
--disable-libgcj --disable-libmudflap --with-slibdir=/lib64
--with-system-zlib --enable-__cxa_atexit
--enable-libstdcxx-allocator=new --disable-libstdcxx-pch
--enable-version-specific-runtime-libs --enable-linker-build-id
--enable-linux-futex --program-suffix=-4.8 --without-system-libunwind
--with-arch-32=i586 --with-tune=generic --build=x86_64-suse-linux
--host=x86_64-suse-linux
Thread model: posix
gcc version 4.8.5 (SUSE Linux)
# make everything
... ...
mdadm.c: In function ‘main’:
mdadm.c:1974:29: error: ‘mdfd’ may be used uninitialized in this
function [-Werror=maybe-uninitialized]
if (dv->devname[0] == '/' || mdfd < 0)
^
mdadm.c:1914:7: note: ‘mdfd’ was declared here
int mdfd;
^
cc1: all warnings being treated as errors
Makefile:206: recipe for target 'mdadm.Os' failed
make: *** [mdadm.Os] Error 1
Thanks,
-Zhilong
On 04/05/2017 11:37 PM, jes.sorensen@gmail.com wrote:
> Zhilong <zlliu@suse.com> writes:
>> Hi,jes;
>> I have found that there is mdfd returns uninitialized warning in
>> mdadm.c. I cannot paste the logs due to I'm on holiday. Please try to
>> issue make everything, you should see it.
> I don't see anything here, if you have specifics, please post them.
>
> Jes
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: mdadm:compiled warning in mdadm.c:1974:29 treats as errors
2017-04-06 8:21 ` Liu Zhilong
@ 2017-04-06 19:10 ` Jes Sorensen
2017-04-06 23:36 ` NeilBrown
0 siblings, 1 reply; 9+ messages in thread
From: Jes Sorensen @ 2017-04-06 19:10 UTC (permalink / raw)
To: Liu Zhilong; +Cc: linux-raid
On 04/06/2017 04:21 AM, Liu Zhilong wrote:
> hi,
>
> I found this compiling warning, and can reproduce on my Leap42.1,
> Leap42.2 and SLES12 SP2 with v4.8.5 version of gcc.
>
> # gcc -v
> Using built-in specs.
> COLLECT_GCC=gcc
> COLLECT_LTO_WRAPPER=/usr/lib64/gcc/x86_64-suse-linux/4.8/lto-wrapper
> Target: x86_64-suse-linux
> Configured with: ../configure --prefix=/usr --infodir=/usr/share/info
> --mandir=/usr/share/man --libdir=/usr/lib64 --libexecdir=/usr/lib64
> --enable-languages=c,c++,objc,fortran,obj-c++,java,ada
> --enable-checking=release --with-gxx-include-dir=/usr/include/c++/4.8
> --enable-ssp --disable-libssp --disable-plugin
> --with-bugurl=http://bugs.opensuse.org/ --with-pkgversion='SUSE Linux'
> --disable-libgcj --disable-libmudflap --with-slibdir=/lib64
> --with-system-zlib --enable-__cxa_atexit
> --enable-libstdcxx-allocator=new --disable-libstdcxx-pch
> --enable-version-specific-runtime-libs --enable-linker-build-id
> --enable-linux-futex --program-suffix=-4.8 --without-system-libunwind
> --with-arch-32=i586 --with-tune=generic --build=x86_64-suse-linux
> --host=x86_64-suse-linux
> Thread model: posix
> gcc version 4.8.5 (SUSE Linux)
>
> # make everything
> ... ...
> mdadm.c: In function ‘main’:
> mdadm.c:1974:29: error: ‘mdfd’ may be used uninitialized in this
> function [-Werror=maybe-uninitialized]
> if (dv->devname[0] == '/' || mdfd < 0)
> ^
> mdadm.c:1914:7: note: ‘mdfd’ was declared here
> int mdfd;
> ^
> cc1: all warnings being treated as errors
> Makefile:206: recipe for target 'mdadm.Os' failed
> make: *** [mdadm.Os] Error 1
Crappy compiler, you're running an old gcc. But sure, send me a patch
that initializes mdfd to -1.
Jes
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: mdadm:compiled warning in mdadm.c:1974:29 treats as errors
2017-04-06 19:10 ` Jes Sorensen
@ 2017-04-06 23:36 ` NeilBrown
2017-04-07 3:53 ` Liuzhilong
2017-04-07 14:53 ` Jes Sorensen
0 siblings, 2 replies; 9+ messages in thread
From: NeilBrown @ 2017-04-06 23:36 UTC (permalink / raw)
To: Jes Sorensen, Liu Zhilong; +Cc: linux-raid
[-- Attachment #1: Type: text/plain, Size: 2090 bytes --]
On Thu, Apr 06 2017, Jes Sorensen wrote:
> On 04/06/2017 04:21 AM, Liu Zhilong wrote:
>> hi,
>>
>> I found this compiling warning, and can reproduce on my Leap42.1,
>> Leap42.2 and SLES12 SP2 with v4.8.5 version of gcc.
>>
>> # gcc -v
>> Using built-in specs.
>> COLLECT_GCC=gcc
>> COLLECT_LTO_WRAPPER=/usr/lib64/gcc/x86_64-suse-linux/4.8/lto-wrapper
>> Target: x86_64-suse-linux
>> Configured with: ../configure --prefix=/usr --infodir=/usr/share/info
>> --mandir=/usr/share/man --libdir=/usr/lib64 --libexecdir=/usr/lib64
>> --enable-languages=c,c++,objc,fortran,obj-c++,java,ada
>> --enable-checking=release --with-gxx-include-dir=/usr/include/c++/4.8
>> --enable-ssp --disable-libssp --disable-plugin
>> --with-bugurl=http://bugs.opensuse.org/ --with-pkgversion='SUSE Linux'
>> --disable-libgcj --disable-libmudflap --with-slibdir=/lib64
>> --with-system-zlib --enable-__cxa_atexit
>> --enable-libstdcxx-allocator=new --disable-libstdcxx-pch
>> --enable-version-specific-runtime-libs --enable-linker-build-id
>> --enable-linux-futex --program-suffix=-4.8 --without-system-libunwind
>> --with-arch-32=i586 --with-tune=generic --build=x86_64-suse-linux
>> --host=x86_64-suse-linux
>> Thread model: posix
>> gcc version 4.8.5 (SUSE Linux)
>>
>> # make everything
>> ... ...
>> mdadm.c: In function ‘main’:
>> mdadm.c:1974:29: error: ‘mdfd’ may be used uninitialized in this
>> function [-Werror=maybe-uninitialized]
>> if (dv->devname[0] == '/' || mdfd < 0)
>> ^
>> mdadm.c:1914:7: note: ‘mdfd’ was declared here
>> int mdfd;
>> ^
>> cc1: all warnings being treated as errors
>> Makefile:206: recipe for target 'mdadm.Os' failed
>> make: *** [mdadm.Os] Error 1
>
> Crappy compiler, you're running an old gcc. But sure, send me a patch
> that initializes mdfd to -1.
I would rather make the code more obviously correct.
if (dv->devname[0] == '/' ||
(mdfd = open_dev(dv->devname)) < 0)
mdfd = open_mddev(dv->devname, 1);
well... it is more obvious to me.
NeilBrown
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 832 bytes --]
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: mdadm:compiled warning in mdadm.c:1974:29 treats as errors
2017-04-06 23:36 ` NeilBrown
@ 2017-04-07 3:53 ` Liuzhilong
2017-04-07 14:53 ` Jes Sorensen
1 sibling, 0 replies; 9+ messages in thread
From: Liuzhilong @ 2017-04-07 3:53 UTC (permalink / raw)
To: NeilBrown, Jes Sorensen, Liu Zhilong; +Cc: linux-raid
On 04/07/2017 07:36 AM, NeilBrown wrote:
> On Thu, Apr 06 2017, Jes Sorensen wrote:
>
>> On 04/06/2017 04:21 AM, Liu Zhilong wrote:
>>> hi,
>>>
>>> I found this compiling warning, and can reproduce on my Leap42.1,
>>> Leap42.2 and SLES12 SP2 with v4.8.5 version of gcc.
>>>
>>> # gcc -v
>>> Using built-in specs.
>>> COLLECT_GCC=gcc
>>> COLLECT_LTO_WRAPPER=/usr/lib64/gcc/x86_64-suse-linux/4.8/lto-wrapper
>>> Target: x86_64-suse-linux
>>> Configured with: ../configure --prefix=/usr --infodir=/usr/share/info
>>> --mandir=/usr/share/man --libdir=/usr/lib64 --libexecdir=/usr/lib64
>>> --enable-languages=c,c++,objc,fortran,obj-c++,java,ada
>>> --enable-checking=release --with-gxx-include-dir=/usr/include/c++/4.8
>>> --enable-ssp --disable-libssp --disable-plugin
>>> --with-bugurl=http://bugs.opensuse.org/ --with-pkgversion='SUSE Linux'
>>> --disable-libgcj --disable-libmudflap --with-slibdir=/lib64
>>> --with-system-zlib --enable-__cxa_atexit
>>> --enable-libstdcxx-allocator=new --disable-libstdcxx-pch
>>> --enable-version-specific-runtime-libs --enable-linker-build-id
>>> --enable-linux-futex --program-suffix=-4.8 --without-system-libunwind
>>> --with-arch-32=i586 --with-tune=generic --build=x86_64-suse-linux
>>> --host=x86_64-suse-linux
>>> Thread model: posix
>>> gcc version 4.8.5 (SUSE Linux)
>>>
>>> # make everything
>>> ... ...
>>> mdadm.c: In function ‘main’:
>>> mdadm.c:1974:29: error: ‘mdfd’ may be used uninitialized in this
>>> function [-Werror=maybe-uninitialized]
>>> if (dv->devname[0] == '/' || mdfd < 0)
>>> ^
>>> mdadm.c:1914:7: note: ‘mdfd’ was declared here
>>> int mdfd;
>>> ^
>>> cc1: all warnings being treated as errors
>>> Makefile:206: recipe for target 'mdadm.Os' failed
>>> make: *** [mdadm.Os] Error 1
>> Crappy compiler, you're running an old gcc. But sure, send me a patch
>> that initializes mdfd to -1.
> I would rather make the code more obviously correct.
>
> if (dv->devname[0] == '/' ||
> (mdfd = open_dev(dv->devname)) < 0)
> mdfd = open_mddev(dv->devname, 1);
>
> well... it is more obvious to me.
I also consider that it's better method for this compiling warning.
And I can send this sample as a patch once jes agrees.
Thanks,
-Zhilong
> NeilBrown
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: mdadm:compiled warning in mdadm.c:1974:29 treats as errors
2017-04-06 23:36 ` NeilBrown
2017-04-07 3:53 ` Liuzhilong
@ 2017-04-07 14:53 ` Jes Sorensen
2017-04-10 4:49 ` [PATCH] mdadm.c:fix compile warning "mdfd is uninitialized" Zhilong Liu
1 sibling, 1 reply; 9+ messages in thread
From: Jes Sorensen @ 2017-04-07 14:53 UTC (permalink / raw)
To: NeilBrown, Liu Zhilong; +Cc: linux-raid
On 04/06/2017 07:36 PM, NeilBrown wrote:
> On Thu, Apr 06 2017, Jes Sorensen wrote:
>
>> On 04/06/2017 04:21 AM, Liu Zhilong wrote:
>>> hi,
>>>
>>> I found this compiling warning, and can reproduce on my Leap42.1,
>>> Leap42.2 and SLES12 SP2 with v4.8.5 version of gcc.
>>>
>>> # gcc -v
>>> Using built-in specs.
>>> COLLECT_GCC=gcc
>>> COLLECT_LTO_WRAPPER=/usr/lib64/gcc/x86_64-suse-linux/4.8/lto-wrapper
>>> Target: x86_64-suse-linux
>>> Configured with: ../configure --prefix=/usr --infodir=/usr/share/info
>>> --mandir=/usr/share/man --libdir=/usr/lib64 --libexecdir=/usr/lib64
>>> --enable-languages=c,c++,objc,fortran,obj-c++,java,ada
>>> --enable-checking=release --with-gxx-include-dir=/usr/include/c++/4.8
>>> --enable-ssp --disable-libssp --disable-plugin
>>> --with-bugurl=http://bugs.opensuse.org/ --with-pkgversion='SUSE Linux'
>>> --disable-libgcj --disable-libmudflap --with-slibdir=/lib64
>>> --with-system-zlib --enable-__cxa_atexit
>>> --enable-libstdcxx-allocator=new --disable-libstdcxx-pch
>>> --enable-version-specific-runtime-libs --enable-linker-build-id
>>> --enable-linux-futex --program-suffix=-4.8 --without-system-libunwind
>>> --with-arch-32=i586 --with-tune=generic --build=x86_64-suse-linux
>>> --host=x86_64-suse-linux
>>> Thread model: posix
>>> gcc version 4.8.5 (SUSE Linux)
>>>
>>> # make everything
>>> ... ...
>>> mdadm.c: In function ‘main’:
>>> mdadm.c:1974:29: error: ‘mdfd’ may be used uninitialized in this
>>> function [-Werror=maybe-uninitialized]
>>> if (dv->devname[0] == '/' || mdfd < 0)
>>> ^
>>> mdadm.c:1914:7: note: ‘mdfd’ was declared here
>>> int mdfd;
>>> ^
>>> cc1: all warnings being treated as errors
>>> Makefile:206: recipe for target 'mdadm.Os' failed
>>> make: *** [mdadm.Os] Error 1
>>
>> Crappy compiler, you're running an old gcc. But sure, send me a patch
>> that initializes mdfd to -1.
>
> I would rather make the code more obviously correct.
>
> if (dv->devname[0] == '/' ||
> (mdfd = open_dev(dv->devname)) < 0)
> mdfd = open_mddev(dv->devname, 1);
>
> well... it is more obvious to me.
I really don't like these convoluted if statements, especially the
recursive assignment of mdfd here.
Cheers,
Jes
^ permalink raw reply [flat|nested] 9+ messages in thread
* [PATCH] mdadm.c:fix compile warning "mdfd is uninitialized"
2017-04-07 14:53 ` Jes Sorensen
@ 2017-04-10 4:49 ` Zhilong Liu
2017-04-11 15:28 ` Jes Sorensen
0 siblings, 1 reply; 9+ messages in thread
From: Zhilong Liu @ 2017-04-10 4:49 UTC (permalink / raw)
To: Jes.Sorensen; +Cc: linux-raid, Zhilong Liu
Initialized the mdfd as -1 to prevent compile error
of some compilers.
For example, gcc version 4.8.5(SUSE Linux).
Signed-off-by: Zhilong Liu <zlliu@suse.com>
---
mdadm.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/mdadm.c b/mdadm.c
index 001ff68..41dae1d 100644
--- a/mdadm.c
+++ b/mdadm.c
@@ -1916,7 +1916,7 @@ static int misc_list(struct mddev_dev *devlist,
int rv = 0;
for (dv = devlist; dv; dv = (rv & 16) ? NULL : dv->next) {
- int mdfd;
+ int mdfd = -1;
switch(dv->disposition) {
case 'D':
--
2.6.6
^ permalink raw reply related [flat|nested] 9+ messages in thread
* Re: [PATCH] mdadm.c:fix compile warning "mdfd is uninitialized"
2017-04-10 4:49 ` [PATCH] mdadm.c:fix compile warning "mdfd is uninitialized" Zhilong Liu
@ 2017-04-11 15:28 ` Jes Sorensen
0 siblings, 0 replies; 9+ messages in thread
From: Jes Sorensen @ 2017-04-11 15:28 UTC (permalink / raw)
To: Zhilong Liu; +Cc: linux-raid
On 04/10/2017 12:49 AM, Zhilong Liu wrote:
> Initialized the mdfd as -1 to prevent compile error
> of some compilers.
> For example, gcc version 4.8.5(SUSE Linux).
>
> Signed-off-by: Zhilong Liu <zlliu@suse.com>
> ---
> mdadm.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
Applied!
Thanks,
Jes
^ permalink raw reply [flat|nested] 9+ messages in thread
end of thread, other threads:[~2017-04-11 15:28 UTC | newest]
Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-04-04 5:31 mdadm:compiled warning in mdadm.c:1974:29 treats as errors Zhilong
2017-04-05 15:37 ` jes.sorensen
2017-04-06 8:21 ` Liu Zhilong
2017-04-06 19:10 ` Jes Sorensen
2017-04-06 23:36 ` NeilBrown
2017-04-07 3:53 ` Liuzhilong
2017-04-07 14:53 ` Jes Sorensen
2017-04-10 4:49 ` [PATCH] mdadm.c:fix compile warning "mdfd is uninitialized" Zhilong Liu
2017-04-11 15:28 ` Jes Sorensen
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.