Skip to contentSkip to conversation

CIFS: use correct format string for size_t

PATCH In review Arnd Bergmann 3 participants 3 messages Feb 2, 2017 – Feb 6, 2017

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 CIFS: use correct format string for size_t

This warning is harmless as size_t is always as wide as 'unsigned long':

fs/cifs/smb2ops.c:2008:245: error: format '%lu' expects argument of type 'long unsigned int', but argument 5 has type 'size_t {aka unsigned int}' [-Werror=format=]

Using %zu however is the correct format string that we don't get a warning for.

Fixes c9d651a5a2fe ("CIFS: Decrypt and process small encrypted packets")
---
 fs/cifs/smb2ops.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
fs/cifs/smb2ops.c +1 -1
index 0764c32754b0..ac6e10adf000 100644
@@ -2005,7 +2005,7 @@ handle_read_data(struct TCP_Server_Info *server, struct mid_q_entry *mid,
 	rdata->iov[0].iov_len = 4;
 	rdata->iov[1].iov_base = buf + 4;
 	rdata->iov[1].iov_len = server->vals->read_rsp_size - 4;
-	cifs_dbg(FYI, "0: iov_base=%p iov_len=%lu\n",
+	cifs_dbg(FYI, "0: iov_base=%p iov_len=%zu\n",
 		 rdata->iov[0].iov_base, server->vals->read_rsp_size);
 
 	length = rdata->copy_into_pages(server, rdata, &iter);
Signature · 1 line
2.9.0
#1 lore raw

2017-02-02 4:21 GMT-08:00 Arnd Bergmann <[email protected]>:

Quoted 28 lines

This warning is harmless as size_t is always as wide as 'unsigned long':

fs/cifs/smb2ops.c:2008:245: error: format '%lu' expects argument of type 'long unsigned int', but argument 5 has type 'size_t {aka unsigned int}' [-Werror=format=]

Using %zu however is the correct format string that we don't get a warning for.

Fixes c9d651a5a2fe ("CIFS: Decrypt and process small encrypted packets")
---
 fs/cifs/smb2ops.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
fs/cifs/smb2ops.c +1 -2
index 0764c32754b0..ac6e10adf000 100644
@@ -2005,7 +2005,7 @@ handle_read_data(struct TCP_Server_Info *server, struct mid_q_entry *mid,
        rdata->iov[0].iov_len = 4;
        rdata->iov[1].iov_base = buf + 4;
        rdata->iov[1].iov_len = server->vals->read_rsp_size - 4;
-       cifs_dbg(FYI, "0: iov_base=%p iov_len=%lu\n",
+       cifs_dbg(FYI, "0: iov_base=%p iov_len=%zu\n",
                 rdata->iov[0].iov_base, server->vals->read_rsp_size);
 
        length = rdata->copy_into_pages(server, rdata, &iter);
--

2.9.0

Quoted 4 lines

--
To unsubscribe from this list: send the line "unsubscribe linux-cifs" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html

This issue have been already fixed in the Steve's for-next branch. Thanks.

Signature · 2 lines
Best regards,
Pavel Shilovsky
Acked-by on v1 1/1
#2 lore raw
In reply to Arnd Bergmann
Quoted 7 lines · Arnd Bergmann

This warning is harmless as size_t is always as wide as 'unsigned long':

fs/cifs/smb2ops.c:2008:245: error: format '%lu' expects argument of type 'long unsigned int', but argument 5 has type 'size_t {aka unsigned int}' [-Werror=format=]

Quoted 6 lines

Using %zu however is the correct format string that we don't get a warning for.

Fixes c9d651a5a2fe ("CIFS: Decrypt and process small encrypted

packets")

Quoted 19 lines

---
 fs/cifs/smb2ops.c | 2 +-

 1 file changed, 1 insertion(+), 1 deletion(-)
fs/cifs/smb2ops.c +1 -1
index 0764c32754b0..ac6e10adf000 100644
@@ -2005,7 +2005,7 @@ handle_read_data(struct TCP_Server_Info
 *server, struct mid_q_entry *mid,
  	rdata->iov[0].iov_len = 4;
  	rdata->iov[1].iov_base = buf + 4;
  	rdata->iov[1].iov_len = server->vals->read_rsp_size - 4;
-	cifs_dbg(FYI, "0: iov_base=%p iov_len=%lu\n",
+	cifs_dbg(FYI, "0: iov_base=%p iov_len=%zu\n",

   rdata->iov[0].iov_base, server->vals-

Quoted 1 line

read_rsp_size);


  length = rdata->copy_into_pages(server, rdata, &iter);