tree:   https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git 
master
head:   e644645abf4788e919beeb97925fb6bf43e890a2
commit: b24ee6c64ca785739b3ef8d95fd6becaad1bde39 NFS: allow deprecation of NFS 
UDP protocol
date:   4 months ago
config: x86_64-defconfig (attached as .config)
compiler: gcc-7 (Ubuntu 7.5.0-6ubuntu2) 7.5.0
reproduce (this is a W=1 build):
        git checkout b24ee6c64ca785739b3ef8d95fd6becaad1bde39
        # save the attached .config to linux build tree
        make ARCH=x86_64 

If you fix the issue, kindly add following tag as appropriate
Reported-by: kbuild test robot <[email protected]>

smatch warnings:
fs/nfs/fs_context.c:1219 nfs_fs_context_validate() warn: inconsistent indenting

vim +1219 fs/nfs/fs_context.c

  1154  
  1155  /*
  1156   * Validate the preparsed information in the config.
  1157   */
  1158  static int nfs_fs_context_validate(struct fs_context *fc)
  1159  {
  1160          struct nfs_fs_context *ctx = nfs_fc2context(fc);
  1161          struct nfs_subversion *nfs_mod;
  1162          struct sockaddr *sap = (struct sockaddr 
*)&ctx->nfs_server.address;
  1163          int max_namelen = PAGE_SIZE;
  1164          int max_pathlen = NFS_MAXPATHLEN;
  1165          int port = 0;
  1166          int ret;
  1167  
  1168          if (!fc->source)
  1169                  goto out_no_device_name;
  1170  
  1171          /* Check for sanity first. */
  1172          if (ctx->minorversion && ctx->version != 4)
  1173                  goto out_minorversion_mismatch;
  1174  
  1175          if (ctx->options & NFS_OPTION_MIGRATION &&
  1176              (ctx->version != 4 || ctx->minorversion != 0))
  1177                  goto out_migration_misuse;
  1178  
  1179          /* Verify that any proto=/mountproto= options match the address
  1180           * families in the addr=/mountaddr= options.
  1181           */
  1182          if (ctx->protofamily != AF_UNSPEC &&
  1183              ctx->protofamily != ctx->nfs_server.address.sa_family)
  1184                  goto out_proto_mismatch;
  1185  
  1186          if (ctx->mountfamily != AF_UNSPEC) {
  1187                  if (ctx->mount_server.addrlen) {
  1188                          if (ctx->mountfamily != 
ctx->mount_server.address.sa_family)
  1189                                  goto out_mountproto_mismatch;
  1190                  } else {
  1191                          if (ctx->mountfamily != 
ctx->nfs_server.address.sa_family)
  1192                                  goto out_mountproto_mismatch;
  1193                  }
  1194          }
  1195  
  1196          if (!nfs_verify_server_address(sap))
  1197                  goto out_no_address;
  1198  
  1199          if (ctx->version == 4) {
  1200                  if (IS_ENABLED(CONFIG_NFS_V4)) {
  1201                          if (ctx->nfs_server.protocol == 
XPRT_TRANSPORT_RDMA)
  1202                                  port = NFS_RDMA_PORT;
  1203                          else
  1204                                  port = NFS_PORT;
  1205                          max_namelen = NFS4_MAXNAMLEN;
  1206                          max_pathlen = NFS4_MAXPATHLEN;
  1207                          nfs_validate_transport_protocol(ctx);
  1208                          if (ctx->nfs_server.protocol == 
XPRT_TRANSPORT_UDP)
  1209                                  goto out_invalid_transport_udp;
  1210                          ctx->flags &= ~(NFS_MOUNT_NONLM | 
NFS_MOUNT_NOACL |
  1211                                          NFS_MOUNT_VER3 | 
NFS_MOUNT_LOCAL_FLOCK |
  1212                                          NFS_MOUNT_LOCAL_FCNTL);
  1213                  } else {
  1214                          goto out_v4_not_compiled;
  1215                  }
  1216          } else {
  1217                  nfs_set_mount_transport_protocol(ctx);
  1218  #ifdef CONFIG_NFS_DISABLE_UDP_SUPPORT
> 1219                 if (ctx->nfs_server.protocol == XPRT_TRANSPORT_UDP)
  1220                         goto out_invalid_transport_udp;
  1221  #endif
  1222                  if (ctx->nfs_server.protocol == XPRT_TRANSPORT_RDMA)
  1223                          port = NFS_RDMA_PORT;
  1224          }
  1225  
  1226          nfs_set_port(sap, &ctx->nfs_server.port, port);
  1227  
  1228          ret = nfs_parse_source(fc, max_namelen, max_pathlen);
  1229          if (ret < 0)
  1230                  return ret;
  1231  
  1232          /* Load the NFS protocol module if we haven't done so yet */
  1233          if (!ctx->nfs_mod) {
  1234                  nfs_mod = get_nfs_version(ctx->version);
  1235                  if (IS_ERR(nfs_mod)) {
  1236                          ret = PTR_ERR(nfs_mod);
  1237                          goto out_version_unavailable;
  1238                  }
  1239                  ctx->nfs_mod = nfs_mod;
  1240          }
  1241          return 0;
  1242  
  1243  out_no_device_name:
  1244          return nfs_invalf(fc, "NFS: Device name not specified");
  1245  out_v4_not_compiled:
  1246          nfs_errorf(fc, "NFS: NFSv4 is not compiled into kernel");
  1247          return -EPROTONOSUPPORT;
  1248  out_invalid_transport_udp:
  1249          return nfs_invalf(fc, "NFSv4: Unsupported transport protocol 
udp");
  1250  out_no_address:
  1251          return nfs_invalf(fc, "NFS: mount program didn't pass remote 
address");
  1252  out_mountproto_mismatch:
  1253          return nfs_invalf(fc, "NFS: Mount server address does not match 
mountproto= option");
  1254  out_proto_mismatch:
  1255          return nfs_invalf(fc, "NFS: Server address does not match 
proto= option");
  1256  out_minorversion_mismatch:
  1257          return nfs_invalf(fc, "NFS: Mount option vers=%u does not 
support minorversion=%u",
  1258                            ctx->version, ctx->minorversion);
  1259  out_migration_misuse:
  1260          return nfs_invalf(fc, "NFS: 'Migration' not supported for this 
NFS version");
  1261  out_version_unavailable:
  1262          nfs_errorf(fc, "NFS: Version unavailable");
  1263          return ret;
  1264  }
  1265  

---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/[email protected]

Attachment: .config.gz
Description: application/gzip

Reply via email to