* [cifs:for-next 12/15] fs/cifs/fs_context.c:650:6: warning: variable 'opt' is used uninitialized whenever 'if' condition is false
@ 2020-12-10 10:25 kernel test robot
0 siblings, 0 replies; only message in thread
From: kernel test robot @ 2020-12-10 10:25 UTC (permalink / raw)
To: Ronnie Sahlberg
Cc: kbuild-all, clang-built-linux, linux-cifs, samba-technical, Steve French
[-- Attachment #1: Type: text/plain, Size: 18692 bytes --]
tree: git://git.samba.org/sfrench/cifs-2.6.git for-next
head: 8f79025175de6bc8cac5c7aa4ea3763e92270058
commit: 8234c06da4fba6440fdb82c172347f4612649801 [12/15] cifs: switch to new mount api
config: powerpc-randconfig-r005-20201209 (attached as .config)
compiler: clang version 12.0.0 (https://github.com/llvm/llvm-project 1968804ac726e7674d5de22bc2204b45857da344)
reproduce (this is a W=1 build):
wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
chmod +x ~/bin/make.cross
# install powerpc cross compiling tool for clang build
# apt-get install binutils-powerpc-linux-gnu
git remote add cifs git://git.samba.org/sfrench/cifs-2.6.git
git fetch --no-tags cifs for-next
git checkout 8234c06da4fba6440fdb82c172347f4612649801
# save the attached .config to linux build tree
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross ARCH=powerpc
If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp@intel.com>
All warnings (new ones prefixed by >>):
>> fs/cifs/fs_context.c:650:6: warning: variable 'opt' is used uninitialized whenever 'if' condition is false [-Wsometimes-uninitialized]
if (!skip_parsing) {
^~~~~~~~~~~~~
fs/cifs/fs_context.c:656:10: note: uninitialized use occurs here
switch (opt) {
^~~
fs/cifs/fs_context.c:650:2: note: remove the 'if' if its condition is always true
if (!skip_parsing) {
^~~~~~~~~~~~~~~~~~~
fs/cifs/fs_context.c:635:12: note: initialize the variable 'opt' to silence this warning
int i, opt;
^
= 0
1 warning generated.
vim +650 fs/cifs/fs_context.c
629
630 static int smb3_fs_context_parse_param(struct fs_context *fc,
631 struct fs_parameter *param)
632 {
633 struct fs_parse_result result;
634 struct smb3_fs_context *ctx = smb3_fc2context(fc);
635 int i, opt;
636 bool is_smb3 = !strcmp(fc->fs_type->name, "smb3");
637 bool skip_parsing = false;
638
639 cifs_dbg(FYI, "CIFS: parsing cifs mount option '%s'\n", param->key);
640
641 /*
642 * fs_parse can not handle string options with an empty value so
643 * we will need special handling of them.
644 */
645 if (param->type == fs_value_is_string && param->string[0] == 0) {
646 if (!strcmp("pass", param->key) || !strcmp("password", param->key))
647 skip_parsing = true;
648 }
649
> 650 if (!skip_parsing) {
651 opt = fs_parse(fc, smb3_fs_parameters, param, &result);
652 if (opt < 0)
653 return ctx->sloppy ? 1 : opt;
654 }
655
656 switch (opt) {
657 case Opt_compress:
658 ctx->compression = UNKNOWN_TYPE;
659 cifs_dbg(VFS,
660 "SMB3 compression support is experimental\n");
661 break;
662 case Opt_nodfs:
663 ctx->nodfs = 1;
664 break;
665 case Opt_hard:
666 if (result.negated)
667 ctx->retry = 0;
668 else
669 ctx->retry = 1;
670 break;
671 case Opt_soft:
672 if (result.negated)
673 ctx->retry = 1;
674 else
675 ctx->retry = 0;
676 break;
677 case Opt_mapposix:
678 if (result.negated)
679 ctx->remap = false;
680 else {
681 ctx->remap = true;
682 ctx->sfu_remap = false; /* disable SFU mapping */
683 }
684 break;
685 case Opt_user_xattr:
686 if (result.negated)
687 ctx->no_xattr = 1;
688 else
689 ctx->no_xattr = 0;
690 break;
691 case Opt_forceuid:
692 if (result.negated)
693 ctx->override_uid = 0;
694 else
695 ctx->override_uid = 1;
696 break;
697 case Opt_forcegid:
698 if (result.negated)
699 ctx->override_gid = 0;
700 else
701 ctx->override_gid = 1;
702 break;
703 case Opt_perm:
704 if (result.negated)
705 ctx->noperm = 1;
706 else
707 ctx->noperm = 0;
708 break;
709 case Opt_dynperm:
710 if (result.negated)
711 ctx->dynperm = 0;
712 else
713 ctx->dynperm = 1;
714 break;
715 case Opt_sfu:
716 if (result.negated)
717 ctx->sfu_emul = 0;
718 else
719 ctx->sfu_emul = 1;
720 break;
721 case Opt_noblocksend:
722 ctx->noblocksnd = 1;
723 break;
724 case Opt_noautotune:
725 ctx->noautotune = 1;
726 break;
727 case Opt_nolease:
728 ctx->no_lease = 1;
729 break;
730 case Opt_nodelete:
731 ctx->nodelete = 1;
732 break;
733 case Opt_multichannel:
734 if (result.negated) {
735 ctx->multichannel = false;
736 ctx->max_channels = 1;
737 } else {
738 ctx->multichannel = true;
739 /* if number of channels not specified, default to 2 */
740 if (ctx->max_channels < 2)
741 ctx->max_channels = 2;
742 }
743 break;
744 case Opt_uid:
745 ctx->linux_uid.val = result.uint_32;
746 ctx->uid_specified = true;
747 break;
748 case Opt_cruid:
749 ctx->cred_uid.val = result.uint_32;
750 break;
751 case Opt_backupgid:
752 ctx->backupgid.val = result.uint_32;
753 ctx->backupgid_specified = true;
754 break;
755 case Opt_gid:
756 ctx->linux_gid.val = result.uint_32;
757 ctx->gid_specified = true;
758 break;
759 case Opt_port:
760 ctx->port = result.uint_32;
761 break;
762 case Opt_file_mode:
763 ctx->file_mode = result.uint_32;
764 break;
765 case Opt_dirmode:
766 ctx->dir_mode = result.uint_32;
767 break;
768 case Opt_min_enc_offload:
769 ctx->min_offload = result.uint_32;
770 break;
771 case Opt_blocksize:
772 /*
773 * inode blocksize realistically should never need to be
774 * less than 16K or greater than 16M and default is 1MB.
775 * Note that small inode block sizes (e.g. 64K) can lead
776 * to very poor performance of common tools like cp and scp
777 */
778 if ((result.uint_32 < CIFS_MAX_MSGSIZE) ||
779 (result.uint_32 > (4 * SMB3_DEFAULT_IOSIZE))) {
780 cifs_dbg(VFS, "%s: Invalid blocksize\n",
781 __func__);
782 goto cifs_parse_mount_err;
783 }
784 ctx->bsize = result.uint_32;
785 break;
786 case Opt_rsize:
787 ctx->rsize = result.uint_32;
788 break;
789 case Opt_wsize:
790 ctx->wsize = result.uint_32;
791 break;
792 case Opt_actimeo:
793 ctx->actimeo = HZ * result.uint_32;
794 if (ctx->actimeo > CIFS_MAX_ACTIMEO) {
795 cifs_dbg(VFS, "attribute cache timeout too large\n");
796 goto cifs_parse_mount_err;
797 }
798 break;
799 case Opt_echo_interval:
800 ctx->echo_interval = result.uint_32;
801 break;
802 case Opt_snapshot:
803 ctx->snapshot_time = result.uint_32;
804 break;
805 case Opt_max_credits:
806 if (result.uint_32 < 20 || result.uint_32 > 60000) {
807 cifs_dbg(VFS, "%s: Invalid max_credits value\n",
808 __func__);
809 goto cifs_parse_mount_err;
810 }
811 ctx->max_credits = result.uint_32;
812 break;
813 case Opt_max_channels:
814 if (result.uint_32 < 1 || result.uint_32 > CIFS_MAX_CHANNELS) {
815 cifs_dbg(VFS, "%s: Invalid max_channels value, needs to be 1-%d\n",
816 __func__, CIFS_MAX_CHANNELS);
817 goto cifs_parse_mount_err;
818 }
819 ctx->max_channels = result.uint_32;
820 break;
821 case Opt_handletimeout:
822 ctx->handle_timeout = result.uint_32;
823 if (ctx->handle_timeout > SMB3_MAX_HANDLE_TIMEOUT) {
824 cifs_dbg(VFS, "Invalid handle cache timeout, longer than 16 minutes\n");
825 goto cifs_parse_mount_err;
826 }
827 break;
828 case Opt_source:
829 kfree(ctx->UNC);
830 ctx->UNC = NULL;
831 switch (smb3_parse_devname(param->string, ctx)) {
832 case 0:
833 break;
834 case -ENOMEM:
835 cifs_dbg(VFS, "Unable to allocate memory for devname\n");
836 goto cifs_parse_mount_err;
837 case -EINVAL:
838 cifs_dbg(VFS, "Malformed UNC in devname\n");
839 goto cifs_parse_mount_err;
840 default:
841 cifs_dbg(VFS, "Unknown error parsing devname\n");
842 goto cifs_parse_mount_err;
843 }
844 fc->source = kstrdup(param->string, GFP_KERNEL);
845 if (fc->source == NULL) {
846 cifs_dbg(VFS, "OOM when copying UNC string\n");
847 goto cifs_parse_mount_err;
848 }
849 break;
850 case Opt_user:
851 kfree(ctx->username);
852 ctx->username = NULL;
853 if (strlen(param->string) == 0) {
854 /* null user, ie. anonymous authentication */
855 ctx->nullauth = 1;
856 break;
857 }
858
859 if (strnlen(param->string, CIFS_MAX_USERNAME_LEN) >
860 CIFS_MAX_USERNAME_LEN) {
861 pr_warn("username too long\n");
862 goto cifs_parse_mount_err;
863 }
864 ctx->username = kstrdup(param->string, GFP_KERNEL);
865 if (ctx->username == NULL) {
866 cifs_dbg(VFS, "OOM when copying username string\n");
867 goto cifs_parse_mount_err;
868 }
869 break;
870 case Opt_pass:
871 kfree(ctx->password);
872 ctx->password = NULL;
873 if (strlen(param->string) == 0)
874 break;
875
876 ctx->password = kstrdup(param->string, GFP_KERNEL);
877 if (ctx->password == NULL) {
878 cifs_dbg(VFS, "OOM when copying password string\n");
879 goto cifs_parse_mount_err;
880 }
881 break;
882 case Opt_ip:
883 if (strlen(param->string) == 0) {
884 ctx->got_ip = false;
885 break;
886 }
887 if (!cifs_convert_address((struct sockaddr *)&ctx->dstaddr,
888 param->string,
889 strlen(param->string))) {
890 pr_err("bad ip= option (%s)\n", param->string);
891 goto cifs_parse_mount_err;
892 }
893 ctx->got_ip = true;
894 break;
895 case Opt_domain:
896 if (strnlen(param->string, CIFS_MAX_DOMAINNAME_LEN)
897 == CIFS_MAX_DOMAINNAME_LEN) {
898 pr_warn("domain name too long\n");
899 goto cifs_parse_mount_err;
900 }
901
902 kfree(ctx->domainname);
903 ctx->domainname = kstrdup(param->string, GFP_KERNEL);
904 if (ctx->domainname == NULL) {
905 cifs_dbg(VFS, "OOM when copying domainname string\n");
906 goto cifs_parse_mount_err;
907 }
908 cifs_dbg(FYI, "Domain name set\n");
909 break;
910 case Opt_srcaddr:
911 if (!cifs_convert_address(
912 (struct sockaddr *)&ctx->srcaddr,
913 param->string, strlen(param->string))) {
914 pr_warn("Could not parse srcaddr: %s\n",
915 param->string);
916 goto cifs_parse_mount_err;
917 }
918 break;
919 case Opt_iocharset:
920 if (strnlen(param->string, 1024) >= 65) {
921 pr_warn("iocharset name too long\n");
922 goto cifs_parse_mount_err;
923 }
924
925 if (strncasecmp(param->string, "default", 7) != 0) {
926 kfree(ctx->iocharset);
927 ctx->iocharset = kstrdup(param->string, GFP_KERNEL);
928 if (ctx->iocharset == NULL) {
929 cifs_dbg(VFS, "OOM when copying iocharset string\n");
930 goto cifs_parse_mount_err;
931 }
932 }
933 /* if iocharset not set then load_nls_default
934 * is used by caller
935 */
936 cifs_dbg(FYI, "iocharset set to %s\n", ctx->iocharset);
937 break;
938 case Opt_netbiosname:
939 memset(ctx->source_rfc1001_name, 0x20,
940 RFC1001_NAME_LEN);
941 /*
942 * FIXME: are there cases in which a comma can
943 * be valid in workstation netbios name (and
944 * need special handling)?
945 */
946 for (i = 0; i < RFC1001_NAME_LEN; i++) {
947 /* don't ucase netbiosname for user */
948 if (param->string[i] == 0)
949 break;
950 ctx->source_rfc1001_name[i] = param->string[i];
951 }
952 /* The string has 16th byte zero still from
953 * set at top of the function
954 */
955 if (i == RFC1001_NAME_LEN && param->string[i] != 0)
956 pr_warn("netbiosname longer than 15 truncated\n");
957 break;
958 case Opt_servern:
959 /* last byte, type, is 0x20 for servr type */
960 memset(ctx->target_rfc1001_name, 0x20,
961 RFC1001_NAME_LEN_WITH_NULL);
962 /*
963 * BB are there cases in which a comma can be valid in this
964 * workstation netbios name (and need special handling)?
965 */
966
967 /* user or mount helper must uppercase the netbios name */
968 for (i = 0; i < 15; i++) {
969 if (param->string[i] == 0)
970 break;
971 ctx->target_rfc1001_name[i] = param->string[i];
972 }
973
974 /* The string has 16th byte zero still from set at top of function */
975 if (i == RFC1001_NAME_LEN && param->string[i] != 0)
976 pr_warn("server netbiosname longer than 15 truncated\n");
977 break;
978 case Opt_ver:
979 /* version of mount userspace tools, not dialect */
980 /* If interface changes in mount.cifs bump to new ver */
981 if (strncasecmp(param->string, "1", 1) == 0) {
982 if (strlen(param->string) > 1) {
983 pr_warn("Bad mount helper ver=%s. Did you want SMB1 (CIFS) dialect and mean to type vers=1.0 instead?\n",
984 param->string);
985 goto cifs_parse_mount_err;
986 }
987 /* This is the default */
988 break;
989 }
990 /* For all other value, error */
991 pr_warn("Invalid mount helper version specified\n");
992 goto cifs_parse_mount_err;
993 case Opt_vers:
994 /* protocol version (dialect) */
995 if (cifs_parse_smb_version(param->string, ctx, is_smb3) != 0)
996 goto cifs_parse_mount_err;
997 ctx->got_version = true;
998 break;
999 case Opt_sec:
1000 if (cifs_parse_security_flavors(param->string, ctx) != 0)
1001 goto cifs_parse_mount_err;
1002 break;
1003 case Opt_cache:
1004 if (cifs_parse_cache_flavor(param->string, ctx) != 0)
1005 goto cifs_parse_mount_err;
1006 break;
1007 case Opt_rootfs:
1008 #ifdef CONFIG_CIFS_ROOT
1009 ctx->rootfs = true;
1010 #endif
1011 break;
1012 case Opt_posixpaths:
1013 if (result.negated)
1014 ctx->posix_paths = 0;
1015 else
1016 ctx->posix_paths = 1;
1017 break;
1018 case Opt_unix:
1019 if (result.negated)
1020 ctx->linux_ext = 0;
1021 else
1022 ctx->no_linux_ext = 1;
1023 break;
1024 case Opt_nocase:
1025 ctx->nocase = 1;
1026 break;
1027 case Opt_brl:
1028 if (result.negated) {
1029 /*
1030 * turn off mandatory locking in mode
1031 * if remote locking is turned off since the
1032 * local vfs will do advisory
1033 */
1034 if (ctx->file_mode ==
1035 (S_IALLUGO & ~(S_ISUID | S_IXGRP)))
1036 ctx->file_mode = S_IALLUGO;
1037 ctx->nobrl = 1;
1038 } else
1039 ctx->nobrl = 0;
1040 break;
1041 case Opt_handlecache:
1042 if (result.negated)
1043 ctx->nohandlecache = 1;
1044 else
1045 ctx->nohandlecache = 0;
1046 break;
1047 case Opt_forcemandatorylock:
1048 ctx->mand_lock = 1;
1049 break;
1050 case Opt_setuids:
1051 ctx->setuids = result.negated;
1052 break;
1053 case Opt_intr:
1054 ctx->intr = !result.negated;
1055 break;
1056 case Opt_setuidfromacl:
1057 ctx->setuidfromacl = 1;
1058 break;
1059 case Opt_strictsync:
1060 ctx->nostrictsync = result.negated;
1061 break;
1062 case Opt_serverino:
1063 ctx->server_ino = !result.negated;
1064 break;
1065 case Opt_rwpidforward:
1066 ctx->rwpidforward = 1;
1067 break;
1068 case Opt_modesid:
1069 ctx->mode_ace = 1;
1070 break;
1071 case Opt_cifsacl:
1072 ctx->cifs_acl = !result.negated;
1073 break;
1074 case Opt_acl:
1075 ctx->no_psx_acl = result.negated;
1076 break;
1077 case Opt_locallease:
1078 ctx->local_lease = 1;
1079 break;
1080 case Opt_sign:
1081 ctx->sign = true;
1082 break;
1083 case Opt_ignore_signature:
1084 ctx->sign = true;
1085 ctx->ignore_signature = true;
1086 break;
1087 case Opt_seal:
1088 /* we do not do the following in secFlags because seal
1089 * is a per tree connection (mount) not a per socket
1090 * or per-smb connection option in the protocol
1091 * vol->secFlg |= CIFSSEC_MUST_SEAL;
1092 */
1093 ctx->seal = 1;
1094 break;
1095 case Opt_noac:
1096 pr_warn("Mount option noac not supported. Instead set /proc/fs/cifs/LookupCacheEnabled to 0\n");
1097 break;
1098 case Opt_fsc:
1099 #ifndef CONFIG_CIFS_FSCACHE
1100 cifs_dbg(VFS, "FS-Cache support needs CONFIG_CIFS_FSCACHE kernel config option set\n");
1101 goto cifs_parse_mount_err;
1102 #endif
1103 ctx->fsc = true;
1104 break;
1105 case Opt_mfsymlinks:
1106 ctx->mfsymlinks = true;
1107 break;
1108 case Opt_multiuser:
1109 ctx->multiuser = true;
1110 break;
1111 case Opt_sloppy:
1112 ctx->sloppy = true;
1113 break;
1114 case Opt_nosharesock:
1115 ctx->nosharesock = true;
1116 break;
1117 case Opt_persistent:
1118 if (result.negated) {
1119 if ((ctx->nopersistent) || (ctx->resilient)) {
1120 cifs_dbg(VFS,
1121 "persistenthandles mount options conflict\n");
1122 goto cifs_parse_mount_err;
1123 }
1124 } else {
1125 ctx->nopersistent = true;
1126 if (ctx->persistent) {
1127 cifs_dbg(VFS,
1128 "persistenthandles mount options conflict\n");
1129 goto cifs_parse_mount_err;
1130 }
1131 }
1132 break;
1133 case Opt_resilient:
1134 if (result.negated) {
1135 ctx->resilient = false; /* already the default */
1136 } else {
1137 ctx->resilient = true;
1138 if (ctx->persistent) {
1139 cifs_dbg(VFS,
1140 "persistenthandles mount options conflict\n");
1141 goto cifs_parse_mount_err;
1142 }
1143 }
1144 break;
1145 case Opt_domainauto:
1146 ctx->domainauto = true;
1147 break;
1148 case Opt_rdma:
1149 ctx->rdma = true;
1150 break;
1151 }
1152
1153 return 0;
1154
1155 cifs_parse_mount_err:
1156 return 1;
1157 }
1158
---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org
[-- Attachment #2: .config.gz --]
[-- Type: application/gzip, Size: 27992 bytes --]
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2020-12-10 10:27 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-12-10 10:25 [cifs:for-next 12/15] fs/cifs/fs_context.c:650:6: warning: variable 'opt' is used uninitialized whenever 'if' condition is false kernel test robot
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).