From: Kevin Cernekee <cernekee-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> To: sfrench-eUNUBHrolfbYtjvyW6yDsg@public.gmane.org Cc: linux-cifs-u79uwXL29TY76Z2rM5mHXA@public.gmane.org, linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org Subject: [PATCH 1/2] [CIFS] Fix signed/unsigned pointer warning Date: Mon, 10 Nov 2014 13:09:23 -0800 [thread overview] Message-ID: <1415653764-22162-1-git-send-email-cernekee@gmail.com> (raw) 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-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> --- 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
WARNING: multiple messages have this Message-ID (diff)
From: Kevin Cernekee <cernekee@gmail.com> To: sfrench@samba.org Cc: linux-cifs@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH 1/2] [CIFS] Fix signed/unsigned pointer warning Date: Mon, 10 Nov 2014 13:09:23 -0800 [thread overview] Message-ID: <1415653764-22162-1-git-send-email-cernekee@gmail.com> (raw) 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
next reply other threads:[~2014-11-10 21:09 UTC|newest] Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top 2014-11-10 21:09 Kevin Cernekee [this message] 2014-11-10 21:09 ` [PATCH 1/2] [CIFS] Fix signed/unsigned pointer warning Kevin Cernekee 2014-11-10 21:09 ` [PATCH 2/2] [CIFS] Update MAINTAINERS entry Kevin Cernekee [not found] ` <1415653764-22162-2-git-send-email-cernekee-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> 2014-11-11 2:58 ` Steve French 2014-11-11 2:58 ` Steve French [not found] ` <1415653764-22162-1-git-send-email-cernekee-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> 2014-12-12 17:19 ` [PATCH 1/2] [CIFS] Fix signed/unsigned pointer warning Kevin Cernekee 2014-12-12 17:19 ` Kevin Cernekee [not found] ` <CAJiQ=7C9qV2acVLWjacwsRmGMbyKUqCT5VbnO5TzeLLX73xMaQ-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org> 2014-12-14 5:20 ` Steve French 2014-12-14 5:20 ` Steve French [not found] ` <CAH2r5mteTRPVNTgVxNLqjdzok87HXxhC+xo+tnR3L0DKntSe6g-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org> 2014-12-14 5:29 ` Kevin Cernekee 2014-12-14 5:29 ` Kevin Cernekee [not found] ` <CAJiQ=7APtRLarnAFFaDy1_KgnBN-wcK2=scOP5Ks0v5GH=AR3Q-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org> 2014-12-15 0:28 ` Steve French 2014-12-15 0:28 ` Steve French [not found] ` <CAH2r5mucwo_FH4M=UUoLNDZNRFFcG9hd=Gxc7ma5jwkJQ2-qTg-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org> 2014-12-15 0:54 ` Kevin Cernekee 2014-12-15 0:54 ` Kevin Cernekee
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=1415653764-22162-1-git-send-email-cernekee@gmail.com \ --to=cernekee-re5jqeeqqe8avxtiumwx3w@public.gmane.org \ --cc=linux-cifs-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \ --cc=linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \ --cc=sfrench-eUNUBHrolfbYtjvyW6yDsg@public.gmane.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: linkBe 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.