Message ID | 1415653764-22162-1-git-send-email-cernekee@gmail.com (mailing list archive) |
---|---|
State | New, archived |
Headers | show |
On Mon, Nov 10, 2014 at 1:09 PM, Kevin Cernekee <cernekee@gmail.com> wrote: > Commit 2ae83bf93882d1 ("[CIFS] Fix setting time before epoch (negative > time values)") changed "u64 t" to "s64 t", which makes do_div() complain > about a pointer signedness mismatch: > > CC fs/cifs/netmisc.o > In file included from ./arch/mips/include/asm/div64.h:12:0, > from include/linux/kernel.h:124, > from include/linux/list.h:8, > from include/linux/wait.h:6, > from include/linux/net.h:23, > from fs/cifs/netmisc.c:25: > fs/cifs/netmisc.c: In function ‘cifs_NTtimeToUnix’: > include/asm-generic/div64.h:43:28: warning: comparison of distinct pointer types lacks a cast [enabled by default] > (void)(((typeof((n)) *)0) == ((uint64_t *)0)); \ > ^ > fs/cifs/netmisc.c:941:22: note: in expansion of macro ‘do_div’ > ts.tv_nsec = (long)do_div(t, 10000000) * 100; > > Introduce a temporary "u64 abs_t" variable to fix this. > > Signed-off-by: Kevin Cernekee <cernekee@gmail.com> > --- > fs/cifs/netmisc.c | 12 +++++++----- > 1 file changed, 7 insertions(+), 5 deletions(-) > > > Note: this is compile-tested only (on a 32-bit build). > > > diff --git a/fs/cifs/netmisc.c b/fs/cifs/netmisc.c > index b333ff6..abae6dd 100644 > --- a/fs/cifs/netmisc.c > +++ b/fs/cifs/netmisc.c > @@ -926,6 +926,7 @@ cifs_NTtimeToUnix(__le64 ntutc) > > /* Subtract the NTFS time offset, then convert to 1s intervals. */ > s64 t = le64_to_cpu(ntutc) - NTFS_TIME_OFFSET; > + u64 abs_t; > > /* > * Unfortunately can not use normal 64 bit division on 32 bit arch, but > @@ -933,13 +934,14 @@ cifs_NTtimeToUnix(__le64 ntutc) > * to special case them > */ > if (t < 0) { > - t = -t; > - ts.tv_nsec = (long)(do_div(t, 10000000) * 100); > + abs_t = -t; > + ts.tv_nsec = (long)(do_div(abs_t, 10000000) * 100); > ts.tv_nsec = -ts.tv_nsec; > - ts.tv_sec = -t; > + ts.tv_sec = -abs_t; > } else { > - ts.tv_nsec = (long)do_div(t, 10000000) * 100; > - ts.tv_sec = t; > + abs_t = t; > + ts.tv_nsec = (long)do_div(abs_t, 10000000) * 100; > + ts.tv_sec = abs_t; > } > > return ts; > -- > 2.1.1 > Hi guys, I am still seeing this warning on Linus' head of tree. Do you think this is something we can pull in for 3.19? Thanks! -- To unsubscribe from this list: send the line "unsubscribe linux-cifs" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Probably harmless patch - but I didn't notice the warning on x86 kernel build (building on Fedora 21, gcc 4.9.2) On Fri, Dec 12, 2014 at 11:19 AM, Kevin Cernekee <cernekee@gmail.com> wrote: > On Mon, Nov 10, 2014 at 1:09 PM, Kevin Cernekee <cernekee@gmail.com> wrote: >> Commit 2ae83bf93882d1 ("[CIFS] Fix setting time before epoch (negative >> time values)") changed "u64 t" to "s64 t", which makes do_div() complain >> about a pointer signedness mismatch: >> >> CC fs/cifs/netmisc.o >> In file included from ./arch/mips/include/asm/div64.h:12:0, >> from include/linux/kernel.h:124, >> from include/linux/list.h:8, >> from include/linux/wait.h:6, >> from include/linux/net.h:23, >> from fs/cifs/netmisc.c:25: >> fs/cifs/netmisc.c: In function ‘cifs_NTtimeToUnix’: >> include/asm-generic/div64.h:43:28: warning: comparison of distinct pointer types lacks a cast [enabled by default] >> (void)(((typeof((n)) *)0) == ((uint64_t *)0)); \ >> ^ >> fs/cifs/netmisc.c:941:22: note: in expansion of macro ‘do_div’ >> ts.tv_nsec = (long)do_div(t, 10000000) * 100; >> >> Introduce a temporary "u64 abs_t" variable to fix this. >> >> Signed-off-by: Kevin Cernekee <cernekee@gmail.com> >> --- >> fs/cifs/netmisc.c | 12 +++++++----- >> 1 file changed, 7 insertions(+), 5 deletions(-) >> >> >> Note: this is compile-tested only (on a 32-bit build). >> >> >> diff --git a/fs/cifs/netmisc.c b/fs/cifs/netmisc.c >> index b333ff6..abae6dd 100644 >> --- a/fs/cifs/netmisc.c >> +++ b/fs/cifs/netmisc.c >> @@ -926,6 +926,7 @@ cifs_NTtimeToUnix(__le64 ntutc) >> >> /* Subtract the NTFS time offset, then convert to 1s intervals. */ >> s64 t = le64_to_cpu(ntutc) - NTFS_TIME_OFFSET; >> + u64 abs_t; >> >> /* >> * Unfortunately can not use normal 64 bit division on 32 bit arch, but >> @@ -933,13 +934,14 @@ cifs_NTtimeToUnix(__le64 ntutc) >> * to special case them >> */ >> if (t < 0) { >> - t = -t; >> - ts.tv_nsec = (long)(do_div(t, 10000000) * 100); >> + abs_t = -t; >> + ts.tv_nsec = (long)(do_div(abs_t, 10000000) * 100); >> ts.tv_nsec = -ts.tv_nsec; >> - ts.tv_sec = -t; >> + ts.tv_sec = -abs_t; >> } else { >> - ts.tv_nsec = (long)do_div(t, 10000000) * 100; >> - ts.tv_sec = t; >> + abs_t = t; >> + ts.tv_nsec = (long)do_div(abs_t, 10000000) * 100; >> + ts.tv_sec = abs_t; >> } >> >> return ts; >> -- >> 2.1.1 >> > > Hi guys, > > I am still seeing this warning on Linus' head of tree. Do you think > this is something we can pull in for 3.19? > > Thanks!
On Sat, Dec 13, 2014 at 9:20 PM, Steve French <smfrench@gmail.com> wrote: > Probably harmless patch - but I didn't notice the warning on x86 > kernel build (building on Fedora 21, gcc 4.9.2) Did you test x86 32-bit or 64-bit? In the generic do_div() implementation, only the former case has an explicit type check. FWIW I'm on 32-bit bit MIPS. -- To unsubscribe from this list: send the line "unsubscribe linux-cifs" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
merged into cifs-2.6.git On Sat, Dec 13, 2014 at 11:29 PM, Kevin Cernekee <cernekee@gmail.com> wrote: > On Sat, Dec 13, 2014 at 9:20 PM, Steve French <smfrench@gmail.com> wrote: >> Probably harmless patch - but I didn't notice the warning on x86 >> kernel build (building on Fedora 21, gcc 4.9.2) > > Did you test x86 32-bit or 64-bit? In the generic do_div() I built current mainline with 64 bit disabled. No warnings on this before or after the patch. > implementation, only the former case has an explicit type check. > > FWIW I'm on 32-bit bit MIPS.
diff --git a/fs/cifs/netmisc.c b/fs/cifs/netmisc.c index b333ff6..abae6dd 100644 --- a/fs/cifs/netmisc.c +++ b/fs/cifs/netmisc.c @@ -926,6 +926,7 @@ cifs_NTtimeToUnix(__le64 ntutc) /* Subtract the NTFS time offset, then convert to 1s intervals. */ s64 t = le64_to_cpu(ntutc) - NTFS_TIME_OFFSET; + u64 abs_t; /* * Unfortunately can not use normal 64 bit division on 32 bit arch, but @@ -933,13 +934,14 @@ cifs_NTtimeToUnix(__le64 ntutc) * to special case them */ if (t < 0) { - t = -t; - ts.tv_nsec = (long)(do_div(t, 10000000) * 100); + abs_t = -t; + ts.tv_nsec = (long)(do_div(abs_t, 10000000) * 100); ts.tv_nsec = -ts.tv_nsec; - ts.tv_sec = -t; + ts.tv_sec = -abs_t; } else { - ts.tv_nsec = (long)do_div(t, 10000000) * 100; - ts.tv_sec = t; + abs_t = t; + ts.tv_nsec = (long)do_div(abs_t, 10000000) * 100; + ts.tv_sec = abs_t; } return ts;
Commit 2ae83bf93882d1 ("[CIFS] Fix setting time before epoch (negative time values)") changed "u64 t" to "s64 t", which makes do_div() complain about a pointer signedness mismatch: CC fs/cifs/netmisc.o In file included from ./arch/mips/include/asm/div64.h:12:0, from include/linux/kernel.h:124, from include/linux/list.h:8, from include/linux/wait.h:6, from include/linux/net.h:23, from fs/cifs/netmisc.c:25: fs/cifs/netmisc.c: In function ‘cifs_NTtimeToUnix’: include/asm-generic/div64.h:43:28: warning: comparison of distinct pointer types lacks a cast [enabled by default] (void)(((typeof((n)) *)0) == ((uint64_t *)0)); \ ^ fs/cifs/netmisc.c:941:22: note: in expansion of macro ‘do_div’ ts.tv_nsec = (long)do_div(t, 10000000) * 100; Introduce a temporary "u64 abs_t" variable to fix this. Signed-off-by: Kevin Cernekee <cernekee@gmail.com> --- fs/cifs/netmisc.c | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) Note: this is compile-tested only (on a 32-bit build).