linux-cifs.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] cifs: use correct format characters
@ 2019-02-27 20:22 Louis Taylor
  2019-02-27 22:00 ` Nick Desaulniers
  2019-02-27 22:25 ` [PATCH v2] " Louis Taylor
  0 siblings, 2 replies; 5+ messages in thread
From: Louis Taylor @ 2019-02-27 20:22 UTC (permalink / raw)
  To: sfrench
  Cc: linux-cifs, samba-technical, linux-kernel, clang-built-linux,
	ndesaulniers, jflat, Louis Taylor

When compiling with -Wformat, clang emits the following warnings:

fs/cifs/smb1ops.c:312:20: warning: format specifies type 'unsigned
short' but the argument has type 'unsigned int' [-Wformat]
                         tgt_total_cnt, total_in_tgt);
                                        ^~~~~~~~~~~~

fs/cifs/cifs_dfs_ref.c:289:4: warning: format specifies type 'short'
but the argument has type 'int' [-Wformat]
                 ref->flags, ref->server_type);
                 ^~~~~~~~~~

fs/cifs/cifs_dfs_ref.c:289:16: warning: format specifies type 'short'
but the argument has type 'int' [-Wformat]
                 ref->flags, ref->server_type);
                             ^~~~~~~~~~~~~~~~

fs/cifs/cifs_dfs_ref.c:291:4: warning: format specifies type 'short'
but the argument has type 'int' [-Wformat]
                 ref->ref_flag, ref->path_consumed);
                 ^~~~~~~~~~~~~

fs/cifs/cifs_dfs_ref.c:291:19: warning: format specifies type 'short'
but the argument has type 'int' [-Wformat]
                 ref->ref_flag, ref->path_consumed);
                                ^~~~~~~~~~~~~~~~~~
The types of these arguments are unconditionally defined, so this patch
updates the format character to the correct ones for ints and unsigned
ints.

Link: https://github.com/ClangBuiltLinux/linux/issues/378
Signed-off-by: Louis Taylor <louis@kragniz.eu>
---
 fs/cifs/cifs_dfs_ref.c | 4 ++--
 fs/cifs/smb1ops.c      | 4 ++--
 2 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/fs/cifs/cifs_dfs_ref.c b/fs/cifs/cifs_dfs_ref.c
index d9b99abe1243..5d83c924cc47 100644
--- a/fs/cifs/cifs_dfs_ref.c
+++ b/fs/cifs/cifs_dfs_ref.c
@@ -285,9 +285,9 @@ static void dump_referral(const struct dfs_info3_param *ref)
 {
 	cifs_dbg(FYI, "DFS: ref path: %s\n", ref->path_name);
 	cifs_dbg(FYI, "DFS: node path: %s\n", ref->node_name);
-	cifs_dbg(FYI, "DFS: fl: %hd, srv_type: %hd\n",
+	cifs_dbg(FYI, "DFS: fl: %d, srv_type: %d\n",
 		 ref->flags, ref->server_type);
-	cifs_dbg(FYI, "DFS: ref_flags: %hd, path_consumed: %hd\n",
+	cifs_dbg(FYI, "DFS: ref_flags: %d, path_consumed: %d\n",
 		 ref->ref_flag, ref->path_consumed);
 }
 
diff --git a/fs/cifs/smb1ops.c b/fs/cifs/smb1ops.c
index 32a6c020478f..52e1ae6744de 100644
--- a/fs/cifs/smb1ops.c
+++ b/fs/cifs/smb1ops.c
@@ -300,7 +300,7 @@ coalesce_t2(char *second_buf, struct smb_hdr *target_hdr)
 	tgt_total_cnt = get_unaligned_le16(&pSMBt->t2_rsp.TotalDataCount);
 
 	if (tgt_total_cnt != src_total_cnt)
-		cifs_dbg(FYI, "total data count of primary and secondary t2 differ source=%hu target=%hu\n",
+		cifs_dbg(FYI, "total data count of primary and secondary t2 differ source=%hu target=%u\n",
 			 src_total_cnt, tgt_total_cnt);
 
 	total_in_tgt = get_unaligned_le16(&pSMBt->t2_rsp.DataCount);
@@ -308,7 +308,7 @@ coalesce_t2(char *second_buf, struct smb_hdr *target_hdr)
 	remaining = tgt_total_cnt - total_in_tgt;
 
 	if (remaining < 0) {
-		cifs_dbg(FYI, "Server sent too much data. tgt_total_cnt=%hu total_in_tgt=%hu\n",
+		cifs_dbg(FYI, "Server sent too much data. tgt_total_cnt=%hu total_in_tgt=%u\n",
 			 tgt_total_cnt, total_in_tgt);
 		return -EPROTO;
 	}
-- 
2.20.1


^ permalink raw reply related	[flat|nested] 5+ messages in thread

* Re: [PATCH] cifs: use correct format characters
  2019-02-27 20:22 [PATCH] cifs: use correct format characters Louis Taylor
@ 2019-02-27 22:00 ` Nick Desaulniers
  2019-02-27 22:25 ` [PATCH v2] " Louis Taylor
  1 sibling, 0 replies; 5+ messages in thread
From: Nick Desaulniers @ 2019-02-27 22:00 UTC (permalink / raw)
  To: Louis Taylor
  Cc: sfrench, linux-cifs, samba-technical, LKML, clang-built-linux,
	Jon Flatley, Matthias Männich

On Wed, Feb 27, 2019 at 12:23 PM Louis Taylor <louis@kragniz.eu> wrote:
>
> When compiling with -Wformat, clang emits the following warnings:
>
> fs/cifs/smb1ops.c:312:20: warning: format specifies type 'unsigned
> short' but the argument has type 'unsigned int' [-Wformat]
>                          tgt_total_cnt, total_in_tgt);
>                                         ^~~~~~~~~~~~

Thanks for the patch! This one fails a small sanity check and needs a revision:

So 1 warning in fs/cifs/smb1ops.c, but 2 fixes?

>
> fs/cifs/cifs_dfs_ref.c:289:4: warning: format specifies type 'short'
> but the argument has type 'int' [-Wformat]
>                  ref->flags, ref->server_type);
>                  ^~~~~~~~~~
>
> fs/cifs/cifs_dfs_ref.c:289:16: warning: format specifies type 'short'
> but the argument has type 'int' [-Wformat]
>                  ref->flags, ref->server_type);
>                              ^~~~~~~~~~~~~~~~
>
> fs/cifs/cifs_dfs_ref.c:291:4: warning: format specifies type 'short'
> but the argument has type 'int' [-Wformat]
>                  ref->ref_flag, ref->path_consumed);
>                  ^~~~~~~~~~~~~
>
> fs/cifs/cifs_dfs_ref.c:291:19: warning: format specifies type 'short'
> but the argument has type 'int' [-Wformat]
>                  ref->ref_flag, ref->path_consumed);
>                                 ^~~~~~~~~~~~~~~~~~
> The types of these arguments are unconditionally defined, so this patch
> updates the format character to the correct ones for ints and unsigned
> ints.
>
> Link: https://github.com/ClangBuiltLinux/linux/issues/378
> Signed-off-by: Louis Taylor <louis@kragniz.eu>
> ---
>  fs/cifs/cifs_dfs_ref.c | 4 ++--
>  fs/cifs/smb1ops.c      | 4 ++--
>  2 files changed, 4 insertions(+), 4 deletions(-)
>
> diff --git a/fs/cifs/cifs_dfs_ref.c b/fs/cifs/cifs_dfs_ref.c
> index d9b99abe1243..5d83c924cc47 100644
> --- a/fs/cifs/cifs_dfs_ref.c
> +++ b/fs/cifs/cifs_dfs_ref.c
> @@ -285,9 +285,9 @@ static void dump_referral(const struct dfs_info3_param *ref)
>  {
>         cifs_dbg(FYI, "DFS: ref path: %s\n", ref->path_name);
>         cifs_dbg(FYI, "DFS: node path: %s\n", ref->node_name);
> -       cifs_dbg(FYI, "DFS: fl: %hd, srv_type: %hd\n",
> +       cifs_dbg(FYI, "DFS: fl: %d, srv_type: %d\n",
>                  ref->flags, ref->server_type);
> -       cifs_dbg(FYI, "DFS: ref_flags: %hd, path_consumed: %hd\n",
> +       cifs_dbg(FYI, "DFS: ref_flags: %d, path_consumed: %d\n",
>                  ref->ref_flag, ref->path_consumed);
>  }
>
> diff --git a/fs/cifs/smb1ops.c b/fs/cifs/smb1ops.c
> index 32a6c020478f..52e1ae6744de 100644
> --- a/fs/cifs/smb1ops.c
> +++ b/fs/cifs/smb1ops.c
> @@ -300,7 +300,7 @@ coalesce_t2(char *second_buf, struct smb_hdr *target_hdr)
>         tgt_total_cnt = get_unaligned_le16(&pSMBt->t2_rsp.TotalDataCount);
>
>         if (tgt_total_cnt != src_total_cnt)
> -               cifs_dbg(FYI, "total data count of primary and secondary t2 differ source=%hu target=%hu\n",
> +               cifs_dbg(FYI, "total data count of primary and secondary t2 differ source=%hu target=%u\n",
>                          src_total_cnt, tgt_total_cnt);

This one is not correct; while you'd be forgiven for confusing the
case here `tgt_total_cnt` with `total_in_tgt` below, the above hunk is
not correct.  `tgt_total_cnt` is an instance of a `__u16`.  Please
resend with this hunk dropped.  The other hunks look correct.

>
>         total_in_tgt = get_unaligned_le16(&pSMBt->t2_rsp.DataCount);
> @@ -308,7 +308,7 @@ coalesce_t2(char *second_buf, struct smb_hdr *target_hdr)
>         remaining = tgt_total_cnt - total_in_tgt;
>
>         if (remaining < 0) {
> -               cifs_dbg(FYI, "Server sent too much data. tgt_total_cnt=%hu total_in_tgt=%hu\n",
> +               cifs_dbg(FYI, "Server sent too much data. tgt_total_cnt=%hu total_in_tgt=%u\n",
>                          tgt_total_cnt, total_in_tgt);
>                 return -EPROTO;
>         }
> --
> 2.20.1
>


-- 
Thanks,
~Nick Desaulniers

^ permalink raw reply	[flat|nested] 5+ messages in thread

* [PATCH v2] cifs: use correct format characters
  2019-02-27 20:22 [PATCH] cifs: use correct format characters Louis Taylor
  2019-02-27 22:00 ` Nick Desaulniers
@ 2019-02-27 22:25 ` Louis Taylor
  2019-02-27 23:13   ` Nick Desaulniers
  2019-02-28  6:01   ` Steve French
  1 sibling, 2 replies; 5+ messages in thread
From: Louis Taylor @ 2019-02-27 22:25 UTC (permalink / raw)
  To: sfrench
  Cc: linux-cifs, samba-technical, linux-kernel, clang-built-linux,
	ndesaulniers, jflat, Louis Taylor

When compiling with -Wformat, clang emits the following warnings:

fs/cifs/smb1ops.c:312:20: warning: format specifies type 'unsigned
short' but the argument has type 'unsigned int' [-Wformat]
                         tgt_total_cnt, total_in_tgt);
                                        ^~~~~~~~~~~~

fs/cifs/cifs_dfs_ref.c:289:4: warning: format specifies type 'short'
but the argument has type 'int' [-Wformat]
                 ref->flags, ref->server_type);
                 ^~~~~~~~~~

fs/cifs/cifs_dfs_ref.c:289:16: warning: format specifies type 'short'
but the argument has type 'int' [-Wformat]
                 ref->flags, ref->server_type);
                             ^~~~~~~~~~~~~~~~

fs/cifs/cifs_dfs_ref.c:291:4: warning: format specifies type 'short'
but the argument has type 'int' [-Wformat]
                 ref->ref_flag, ref->path_consumed);
                 ^~~~~~~~~~~~~

fs/cifs/cifs_dfs_ref.c:291:19: warning: format specifies type 'short'
but the argument has type 'int' [-Wformat]
                 ref->ref_flag, ref->path_consumed);
                                ^~~~~~~~~~~~~~~~~~
The types of these arguments are unconditionally defined, so this patch
updates the format character to the correct ones for ints and unsigned
ints.

Link: https://github.com/ClangBuiltLinux/linux/issues/378
Signed-off-by: Louis Taylor <louis@kragniz.eu>
---
 fs/cifs/cifs_dfs_ref.c | 4 ++--
 fs/cifs/smb1ops.c      | 2 +-
 2 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/fs/cifs/cifs_dfs_ref.c b/fs/cifs/cifs_dfs_ref.c
index d9b99abe1243..5d83c924cc47 100644
--- a/fs/cifs/cifs_dfs_ref.c
+++ b/fs/cifs/cifs_dfs_ref.c
@@ -285,9 +285,9 @@ static void dump_referral(const struct dfs_info3_param *ref)
 {
 	cifs_dbg(FYI, "DFS: ref path: %s\n", ref->path_name);
 	cifs_dbg(FYI, "DFS: node path: %s\n", ref->node_name);
-	cifs_dbg(FYI, "DFS: fl: %hd, srv_type: %hd\n",
+	cifs_dbg(FYI, "DFS: fl: %d, srv_type: %d\n",
 		 ref->flags, ref->server_type);
-	cifs_dbg(FYI, "DFS: ref_flags: %hd, path_consumed: %hd\n",
+	cifs_dbg(FYI, "DFS: ref_flags: %d, path_consumed: %d\n",
 		 ref->ref_flag, ref->path_consumed);
 }
 
diff --git a/fs/cifs/smb1ops.c b/fs/cifs/smb1ops.c
index 32a6c020478f..20a88776f04d 100644
--- a/fs/cifs/smb1ops.c
+++ b/fs/cifs/smb1ops.c
@@ -308,7 +308,7 @@ coalesce_t2(char *second_buf, struct smb_hdr *target_hdr)
 	remaining = tgt_total_cnt - total_in_tgt;
 
 	if (remaining < 0) {
-		cifs_dbg(FYI, "Server sent too much data. tgt_total_cnt=%hu total_in_tgt=%hu\n",
+		cifs_dbg(FYI, "Server sent too much data. tgt_total_cnt=%hu total_in_tgt=%u\n",
 			 tgt_total_cnt, total_in_tgt);
 		return -EPROTO;
 	}
-- 
2.20.1


^ permalink raw reply related	[flat|nested] 5+ messages in thread

* Re: [PATCH v2] cifs: use correct format characters
  2019-02-27 22:25 ` [PATCH v2] " Louis Taylor
@ 2019-02-27 23:13   ` Nick Desaulniers
  2019-02-28  6:01   ` Steve French
  1 sibling, 0 replies; 5+ messages in thread
From: Nick Desaulniers @ 2019-02-27 23:13 UTC (permalink / raw)
  To: Louis Taylor
  Cc: sfrench, linux-cifs, samba-technical, LKML, clang-built-linux,
	Jon Flatley

On Wed, Feb 27, 2019 at 2:26 PM Louis Taylor <louis@kragniz.eu> wrote:
>
> When compiling with -Wformat, clang emits the following warnings:
>
> fs/cifs/smb1ops.c:312:20: warning: format specifies type 'unsigned
> short' but the argument has type 'unsigned int' [-Wformat]
>                          tgt_total_cnt, total_in_tgt);
>                                         ^~~~~~~~~~~~
>
> fs/cifs/cifs_dfs_ref.c:289:4: warning: format specifies type 'short'
> but the argument has type 'int' [-Wformat]
>                  ref->flags, ref->server_type);
>                  ^~~~~~~~~~
>
> fs/cifs/cifs_dfs_ref.c:289:16: warning: format specifies type 'short'
> but the argument has type 'int' [-Wformat]
>                  ref->flags, ref->server_type);
>                              ^~~~~~~~~~~~~~~~
>
> fs/cifs/cifs_dfs_ref.c:291:4: warning: format specifies type 'short'
> but the argument has type 'int' [-Wformat]
>                  ref->ref_flag, ref->path_consumed);
>                  ^~~~~~~~~~~~~
>
> fs/cifs/cifs_dfs_ref.c:291:19: warning: format specifies type 'short'
> but the argument has type 'int' [-Wformat]
>                  ref->ref_flag, ref->path_consumed);
>                                 ^~~~~~~~~~~~~~~~~~
> The types of these arguments are unconditionally defined, so this patch
> updates the format character to the correct ones for ints and unsigned
> ints.
>
> Link: https://github.com/ClangBuiltLinux/linux/issues/378
> Signed-off-by: Louis Taylor <louis@kragniz.eu>

Thanks for following up on the feedback.
Reviewed-by: Nick Desaulniers <ndesaulniers@google.com>

> ---
>  fs/cifs/cifs_dfs_ref.c | 4 ++--
>  fs/cifs/smb1ops.c      | 2 +-
>  2 files changed, 3 insertions(+), 3 deletions(-)
>
> diff --git a/fs/cifs/cifs_dfs_ref.c b/fs/cifs/cifs_dfs_ref.c
> index d9b99abe1243..5d83c924cc47 100644
> --- a/fs/cifs/cifs_dfs_ref.c
> +++ b/fs/cifs/cifs_dfs_ref.c
> @@ -285,9 +285,9 @@ static void dump_referral(const struct dfs_info3_param *ref)
>  {
>         cifs_dbg(FYI, "DFS: ref path: %s\n", ref->path_name);
>         cifs_dbg(FYI, "DFS: node path: %s\n", ref->node_name);
> -       cifs_dbg(FYI, "DFS: fl: %hd, srv_type: %hd\n",
> +       cifs_dbg(FYI, "DFS: fl: %d, srv_type: %d\n",
>                  ref->flags, ref->server_type);
> -       cifs_dbg(FYI, "DFS: ref_flags: %hd, path_consumed: %hd\n",
> +       cifs_dbg(FYI, "DFS: ref_flags: %d, path_consumed: %d\n",
>                  ref->ref_flag, ref->path_consumed);
>  }
>
> diff --git a/fs/cifs/smb1ops.c b/fs/cifs/smb1ops.c
> index 32a6c020478f..20a88776f04d 100644
> --- a/fs/cifs/smb1ops.c
> +++ b/fs/cifs/smb1ops.c
> @@ -308,7 +308,7 @@ coalesce_t2(char *second_buf, struct smb_hdr *target_hdr)
>         remaining = tgt_total_cnt - total_in_tgt;
>
>         if (remaining < 0) {
> -               cifs_dbg(FYI, "Server sent too much data. tgt_total_cnt=%hu total_in_tgt=%hu\n",
> +               cifs_dbg(FYI, "Server sent too much data. tgt_total_cnt=%hu total_in_tgt=%u\n",
>                          tgt_total_cnt, total_in_tgt);
>                 return -EPROTO;
>         }
> --
> 2.20.1
>


-- 
Thanks,
~Nick Desaulniers

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH v2] cifs: use correct format characters
  2019-02-27 22:25 ` [PATCH v2] " Louis Taylor
  2019-02-27 23:13   ` Nick Desaulniers
@ 2019-02-28  6:01   ` Steve French
  1 sibling, 0 replies; 5+ messages in thread
From: Steve French @ 2019-02-28  6:01 UTC (permalink / raw)
  To: Louis Taylor
  Cc: Steve French, CIFS, samba-technical, LKML, clang-built-linux,
	ndesaulniers, jflat

merged into cifs-2.6.git for-next

On Wed, Feb 27, 2019 at 4:27 PM Louis Taylor <louis@kragniz.eu> wrote:
>
> When compiling with -Wformat, clang emits the following warnings:
>
> fs/cifs/smb1ops.c:312:20: warning: format specifies type 'unsigned
> short' but the argument has type 'unsigned int' [-Wformat]
>                          tgt_total_cnt, total_in_tgt);
>                                         ^~~~~~~~~~~~
>
> fs/cifs/cifs_dfs_ref.c:289:4: warning: format specifies type 'short'
> but the argument has type 'int' [-Wformat]
>                  ref->flags, ref->server_type);
>                  ^~~~~~~~~~
>
> fs/cifs/cifs_dfs_ref.c:289:16: warning: format specifies type 'short'
> but the argument has type 'int' [-Wformat]
>                  ref->flags, ref->server_type);
>                              ^~~~~~~~~~~~~~~~
>
> fs/cifs/cifs_dfs_ref.c:291:4: warning: format specifies type 'short'
> but the argument has type 'int' [-Wformat]
>                  ref->ref_flag, ref->path_consumed);
>                  ^~~~~~~~~~~~~
>
> fs/cifs/cifs_dfs_ref.c:291:19: warning: format specifies type 'short'
> but the argument has type 'int' [-Wformat]
>                  ref->ref_flag, ref->path_consumed);
>                                 ^~~~~~~~~~~~~~~~~~
> The types of these arguments are unconditionally defined, so this patch
> updates the format character to the correct ones for ints and unsigned
> ints.
>
> Link: https://github.com/ClangBuiltLinux/linux/issues/378
> Signed-off-by: Louis Taylor <louis@kragniz.eu>
> ---
>  fs/cifs/cifs_dfs_ref.c | 4 ++--
>  fs/cifs/smb1ops.c      | 2 +-
>  2 files changed, 3 insertions(+), 3 deletions(-)
>
> diff --git a/fs/cifs/cifs_dfs_ref.c b/fs/cifs/cifs_dfs_ref.c
> index d9b99abe1243..5d83c924cc47 100644
> --- a/fs/cifs/cifs_dfs_ref.c
> +++ b/fs/cifs/cifs_dfs_ref.c
> @@ -285,9 +285,9 @@ static void dump_referral(const struct dfs_info3_param *ref)
>  {
>         cifs_dbg(FYI, "DFS: ref path: %s\n", ref->path_name);
>         cifs_dbg(FYI, "DFS: node path: %s\n", ref->node_name);
> -       cifs_dbg(FYI, "DFS: fl: %hd, srv_type: %hd\n",
> +       cifs_dbg(FYI, "DFS: fl: %d, srv_type: %d\n",
>                  ref->flags, ref->server_type);
> -       cifs_dbg(FYI, "DFS: ref_flags: %hd, path_consumed: %hd\n",
> +       cifs_dbg(FYI, "DFS: ref_flags: %d, path_consumed: %d\n",
>                  ref->ref_flag, ref->path_consumed);
>  }
>
> diff --git a/fs/cifs/smb1ops.c b/fs/cifs/smb1ops.c
> index 32a6c020478f..20a88776f04d 100644
> --- a/fs/cifs/smb1ops.c
> +++ b/fs/cifs/smb1ops.c
> @@ -308,7 +308,7 @@ coalesce_t2(char *second_buf, struct smb_hdr *target_hdr)
>         remaining = tgt_total_cnt - total_in_tgt;
>
>         if (remaining < 0) {
> -               cifs_dbg(FYI, "Server sent too much data. tgt_total_cnt=%hu total_in_tgt=%hu\n",
> +               cifs_dbg(FYI, "Server sent too much data. tgt_total_cnt=%hu total_in_tgt=%u\n",
>                          tgt_total_cnt, total_in_tgt);
>                 return -EPROTO;
>         }
> --
> 2.20.1
>


-- 
Thanks,

Steve

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2019-02-28  6:01 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-02-27 20:22 [PATCH] cifs: use correct format characters Louis Taylor
2019-02-27 22:00 ` Nick Desaulniers
2019-02-27 22:25 ` [PATCH v2] " Louis Taylor
2019-02-27 23:13   ` Nick Desaulniers
2019-02-28  6:01   ` Steve French

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).