Commit 5216a8e70e25b01cbd2915cd0442fb96deb2c262

Authored by Pavel Emelyanov
Committed by Trond Myklebust
1 parent 90dc7d2796

Wrap buffers used for rpc debug printks into RPC_IFDEBUG

Sorry for the noise, but here's the v3 of this compilation fix :)

There are some places, which declare the char buf[...] on the stack
to push it later into dprintk(). Since the dprintk sometimes (if the
CONFIG_SYSCTL=n) becomes an empty do { } while (0) stub, these buffers
cause gcc to produce appropriate warnings.

Wrap these buffers with RPC_IFDEBUG macro, as Trond proposed, to
compile them out when not needed.

Signed-off-by: Pavel Emelyanov <xemul@openvz.org>
Acked-by: J. Bruce Fields <bfields@citi.umich.edu>
Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com>

Showing 4 changed files with 6 additions and 6 deletions Side-by-side Diff

... ... @@ -153,7 +153,7 @@
153 153 */
154 154 while ((nlmsvc_users || !signalled()) && nlmsvc_pid == current->pid) {
155 155 long timeout = MAX_SCHEDULE_TIMEOUT;
156   - char buf[RPC_MAX_ADDRBUFLEN];
  156 + RPC_IFDEBUG(char buf[RPC_MAX_ADDRBUFLEN]);
157 157  
158 158 if (signalled()) {
159 159 flush_signals(current);
... ... @@ -172,7 +172,7 @@
172 172 static int nfs_callback_authenticate(struct svc_rqst *rqstp)
173 173 {
174 174 struct nfs_client *clp;
175   - char buf[RPC_MAX_ADDRBUFLEN];
  175 + RPC_IFDEBUG(char buf[RPC_MAX_ADDRBUFLEN]);
176 176  
177 177 /* Don't talk to strangers */
178 178 clp = nfs_find_client(svc_addr(rqstp), 4);
... ... @@ -101,7 +101,7 @@
101 101 {
102 102 /* Check if the request originated from a secure port. */
103 103 if (!rqstp->rq_secure && EX_SECURE(exp)) {
104   - char buf[RPC_MAX_ADDRBUFLEN];
  104 + RPC_IFDEBUG(char buf[RPC_MAX_ADDRBUFLEN]);
105 105 dprintk(KERN_WARNING
106 106 "nfsd: request from insecure port %s!\n",
107 107 svc_print_addr(rqstp, buf, sizeof(buf)));
net/sunrpc/svcsock.c
... ... @@ -175,7 +175,7 @@
175 175 size_t base = xdr->page_base;
176 176 unsigned int pglen = xdr->page_len;
177 177 unsigned int flags = MSG_MORE;
178   - char buf[RPC_MAX_ADDRBUFLEN];
  178 + RPC_IFDEBUG(char buf[RPC_MAX_ADDRBUFLEN]);
179 179  
180 180 slen = xdr->len;
181 181  
... ... @@ -716,7 +716,7 @@
716 716 struct socket *newsock;
717 717 struct svc_sock *newsvsk;
718 718 int err, slen;
719   - char buf[RPC_MAX_ADDRBUFLEN];
  719 + RPC_IFDEBUG(char buf[RPC_MAX_ADDRBUFLEN]);
720 720  
721 721 dprintk("svc: tcp_accept %p sock %p\n", svsk, sock);
722 722 if (!sock)
723 723  
... ... @@ -1206,10 +1206,10 @@
1206 1206 struct socket *sock;
1207 1207 int error;
1208 1208 int type;
1209   - char buf[RPC_MAX_ADDRBUFLEN];
1210 1209 struct sockaddr_storage addr;
1211 1210 struct sockaddr *newsin = (struct sockaddr *)&addr;
1212 1211 int newlen;
  1212 + RPC_IFDEBUG(char buf[RPC_MAX_ADDRBUFLEN]);
1213 1213  
1214 1214 dprintk("svc: svc_create_socket(%s, %d, %s)\n",
1215 1215 serv->sv_program->pg_name, protocol,