Skip to contentSkip to conversation

nfsd: use correct format characters

PATCH In review Bill Wendling 3 participants 6 messages Mar 16, 2022 – Mar 17, 2022 1 message not in the archive

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

PATCH 1/1 nfsd: use correct format characters

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

fs/nfsd/flexfilelayout.c:120:27: warning: format specifies type 'unsigned char' but the argument has type 'int' [-Wformat]

                         "%s.%hhu.%hhu", addr, port >> 8, port & 0xff);
                             ~~~~              ^~~~~~~~~
                             %d
fs/nfsd/flexfilelayout.c:120:38: warning: format specifies type 'unsigned
char' but the argument has type 'int' [-Wformat]
                         "%s.%hhu.%hhu", addr, port >> 8, port & 0xff);
                                  ~~~~                    ^~~~~~~~~~~
                                  %d

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 ClangBuiltLinux/linux#378
---
 fs/nfsd/flexfilelayout.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
fs/nfsd/flexfilelayout.c +1 -1
index 2e2f1d5e9f62..070f90ed09b6 100644
@@ -117,7 +117,7 @@ nfsd4_ff_proc_getdeviceinfo(struct super_block *sb, struct svc_rqst *rqstp,
 
 	da->netaddr.addr_len =
 		snprintf(da->netaddr.addr, FF_ADDR_LEN + 1,
-			 "%s.%hhu.%hhu", addr, port >> 8, port & 0xff);
+			 "%s.%d.%d", addr, port >> 8, port & 0xff);
 
 	da->tightly_coupled = false;
 
Signature · 1 line
2.35.1.723.g4982287a31-goog
#1 lore raw

Hi--

Quoted 13 lines · Bill Wendling

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

fs/nfsd/flexfilelayout.c:120:27: warning: format specifies type 'unsigned char' but the argument has type 'int' [-Wformat]

                         "%s.%hhu.%hhu", addr, port >> 8, port & 0xff);
                             ~~~~              ^~~~~~~~~
                             %d
fs/nfsd/flexfilelayout.c:120:38: warning: format specifies type 'unsigned
char' but the argument has type 'int' [-Wformat]
                         "%s.%hhu.%hhu", addr, port >> 8, port & 0xff);
                                  ~~~~                    ^~~~~~~~~~~
                                  %d
Quoted 5 lines

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 ClangBuiltLinux/linux#378

Please make the Link: more complete, such as a URL/URI.

Quoted 10 lines
---
 fs/nfsd/flexfilelayout.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
fs/nfsd/flexfilelayout.c +0 -0
index 2e2f1d5e9f62..070f90ed09b6 100644

fs/nfsd/flexfilelayout.c nfsd4_ff_proc_getdeviceinfo(struct super_block *sb, struct svc_rqst *rqstp, · line 123

Quoted 8 lines
fs/nfsd/flexfilelayout.c +1 -1
@@ -117,7 +117,7 @@ nfsd4_ff_proc_getdeviceinfo(struct super_block *sb, struct svc_rqst *rqstp,
 
 	da->netaddr.addr_len =
 		snprintf(da->netaddr.addr, FF_ADDR_LEN + 1,
-			 "%s.%hhu.%hhu", addr, port >> 8, port & 0xff);
+			 "%s.%d.%d", addr, port >> 8, port & 0xff);
 
 	da->tightly_coupled = false;
 

thanks.

Signature · 1 line
~Randy
#2 lore raw
Quoted 17 lines · Randy Dunlap

Hi--

Quoted 13 lines · Bill Wendling

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

fs/nfsd/flexfilelayout.c:120:27: warning: format specifies type 'unsigned char' but the argument has type 'int' [-Wformat]

                         "%s.%hhu.%hhu", addr, port >> 8, port & 0xff);
                             ~~~~              ^~~~~~~~~
                             %d
fs/nfsd/flexfilelayout.c:120:38: warning: format specifies type 'unsigned
char' but the argument has type 'int' [-Wformat]
                         "%s.%hhu.%hhu", addr, port >> 8, port & 0xff);
                                  ~~~~                    ^~~~~~~~~~~
                                  %d
Quoted 8 lines
Quoted 5 lines

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 ClangBuiltLinux/linux#378

Please make the Link: more complete, such as a URL/URI.

Done. I sent out v2 of the patch. Sorry about this oversight!

-bw

Quoted 22 lines
Quoted 10 lines
---
 fs/nfsd/flexfilelayout.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
fs/nfsd/flexfilelayout.c +0 -0
index 2e2f1d5e9f62..070f90ed09b6 100644

fs/nfsd/flexfilelayout.c nfsd4_ff_proc_getdeviceinfo(struct super_block *sb, struct svc_rqst *rqstp, · line 123

Quoted 8 lines
fs/nfsd/flexfilelayout.c +1 -1
@@ -117,7 +117,7 @@ nfsd4_ff_proc_getdeviceinfo(struct super_block *sb, struct svc_rqst *rqstp,
 
      da->netaddr.addr_len =
              snprintf(da->netaddr.addr, FF_ADDR_LEN + 1,
-                      "%s.%hhu.%hhu", addr, port >> 8, port & 0xff);
+                      "%s.%d.%d", addr, port >> 8, port & 0xff);
 
      da->tightly_coupled = false;
 

thanks.
--
~Randy

#3 lore raw

PATCH v2 1/1 nfsd: use correct format characters

In reply to Bill Wendling

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

fs/nfsd/flexfilelayout.c:120:27: warning: format specifies type 'unsigned char' but the argument has type 'int' [-Wformat]

                         "%s.%hhu.%hhu", addr, port >> 8, port & 0xff);
                             ~~~~              ^~~~~~~~~
                             %d
fs/nfsd/flexfilelayout.c:120:38: warning: format specifies type 'unsigned
char' but the argument has type 'int' [-Wformat]
                         "%s.%hhu.%hhu", addr, port >> 8, port & 0xff);
                                  ~~~~                    ^~~~~~~~~~~
                                  %d

The types of these arguments are unconditionally defined, so this patch updates the format character to the correct ones for ints and unsigned ints.

---
v2 - Fixed "Link" to be a valid URL.

---
 fs/nfsd/flexfilelayout.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
fs/nfsd/flexfilelayout.c +1 -1
index 2e2f1d5e9f62..070f90ed09b6 100644
@@ -117,7 +117,7 @@ nfsd4_ff_proc_getdeviceinfo(struct super_block *sb, struct svc_rqst *rqstp,
 
 	da->netaddr.addr_len =
 		snprintf(da->netaddr.addr, FF_ADDR_LEN + 1,
-			 "%s.%hhu.%hhu", addr, port >> 8, port & 0xff);
+			 "%s.%d.%d", addr, port >> 8, port & 0xff);
 
 	da->tightly_coupled = false;
 
Signature · 1 line
2.35.1.723.g4982287a31-goog
#4 lore raw
Quoted 17 lines · Bill Wendling

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

fs/nfsd/flexfilelayout.c:120:27: warning: format specifies type 'unsigned char' but the argument has type 'int' [-Wformat]

                        "%s.%hhu.%hhu", addr, port >> 8, port & 0xff);
                            ~~~~              ^~~~~~~~~
                            %d
fs/nfsd/flexfilelayout.c:120:38: warning: format specifies type 'unsigned
char' but the argument has type 'int' [-Wformat]
                        "%s.%hhu.%hhu", addr, port >> 8, port & 0xff);
                                 ~~~~                    ^~~~~~~~~~~
                                 %d
Quoted 8 lines

The types of these arguments are unconditionally defined, so this patch updates the format character to the correct ones for ints and unsigned ints.

---
v2 - Fixed "Link" to be a valid URL.

Hi Tom, can I get a Reviewed-by from you?

Quoted 20 lines

---
fs/nfsd/flexfilelayout.c | 2 +-

1 file changed, 1 insertion(+), 1 deletion(-)
fs/nfsd/flexfilelayout.c +1 -1
index 2e2f1d5e9f62..070f90ed09b6 100644
@@ -117,7 +117,7 @@ nfsd4_ff_proc_getdeviceinfo(struct super_block *sb, struct svc_rqst *rqstp,
 
 	da->netaddr.addr_len =
 		snprintf(da->netaddr.addr, FF_ADDR_LEN + 1,
-			 "%s.%hhu.%hhu", addr, port >> 8, port & 0xff);
+			 "%s.%d.%d", addr, port >> 8, port & 0xff);
 
 	da->tightly_coupled = false;
 
Signature · 1 line
2.35.1.723.g4982287a31-goog

--
Chuck Lever

A message that is not in the archive (sent off-list or not yet received): [email protected]

#6 lore raw
Quoted 46 lines · Thomas Haynes
Quoted 43 lines · Bill Wendling

[You don't often get email from [email protected]. Learn why this is important at http://aka.ms/LearnAboutSenderIdentification.]

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

fs/nfsd/flexfilelayout.c:120:27: warning: format specifies type 'unsigned char' but the argument has type 'int' [-Wformat]

                        "%s.%hhu.%hhu", addr, port >> 8, port & 0xff);
                            ~~~~              ^~~~~~~~~
                            %d
fs/nfsd/flexfilelayout.c:120:38: warning: format specifies type 'unsigned
char' but the argument has type 'int' [-Wformat]
                        "%s.%hhu.%hhu", addr, port >> 8, port & 0xff);
                                 ~~~~                    ^~~~~~~~~~~
                                 %d

The types of these arguments are unconditionally defined, so this patch updates the format character to the correct ones for ints and unsigned ints.

---
v2 - Fixed "Link" to be a valid URL.
---
fs/nfsd/flexfilelayout.c | 2 +-

1 file changed, 1 insertion(+), 1 deletion(-)
fs/nfsd/flexfilelayout.c +1 -1
index 2e2f1d5e9f62..070f90ed09b6 100644
@@ -117,7 +117,7 @@ nfsd4_ff_proc_getdeviceinfo(struct super_block *sb, struct svc_rqst *rqstp,
 
       da->netaddr.addr_len =
               snprintf(da->netaddr.addr, FF_ADDR_LEN + 1,
-                        "%s.%hhu.%hhu", addr, port >> 8, port & 0xff);
+                        "%s.%d.%d", addr, port >> 8, port & 0xff);
 
Quoted 8 lines
Quoted 5 lines
fs/nfsd/flexfilelayout.c +0 -1
       da->tightly_coupled = false;
 
--

2.35.1.723.g4982287a31-goog

Perfect, thanks!

--
Chuck Lever