tree: git://git.linux-nfs.org/projects/trondmy/linux-nfs.git testing head: f3d63f03d9edb901e66c7c93643d2b78edd67daf commit: f3d63f03d9edb901e66c7c93643d2b78edd67daf [31/31] pNFS: Clean up open coded kmemdup_nul() config: x86_64-rhel (attached as .config) compiler: gcc-9 (Debian 9.3.0-15) 9.3.0 reproduce (this is a W=1 build): git remote add nfs git://git.linux-nfs.org/projects/trondmy/linux-nfs.git git fetch --no-tags nfs testing git checkout f3d63f03d9edb901e66c7c93643d2b78edd67daf # save the attached .config to linux build tree make W=1 ARCH=x86_64 If you fix the issue, kindly add following tag as appropriate Reported-by: kernel test robot All errors (new ones prefixed by >>): fs/nfs/pnfs_nfs.c: In function 'nfs4_decode_mp_ds_addr': >> fs/nfs/pnfs_nfs.c:1088:22: error: passing argument 1 of 'kmemdup_nul' from incompatible pointer type [-Werror=incompatible-pointer-types] 1088 | netid = kmemdup_nul(p, nlen, gfp_flags); | ^ | | | __be32 * {aka unsigned int *} In file included from include/linux/bitmap.h:9, from include/linux/cpumask.h:12, from arch/x86/include/asm/cpumask.h:5, from arch/x86/include/asm/msr.h:11, from arch/x86/include/asm/processor.h:22, from arch/x86/include/asm/cpufeature.h:5, from arch/x86/include/asm/thread_info.h:53, from include/linux/thread_info.h:38, from include/linux/uio.h:9, from include/linux/socket.h:8, from include/uapi/linux/in.h:24, from include/linux/in.h:19, from include/linux/nfs_fs.h:22, from fs/nfs/pnfs_nfs.c:11: include/linux/string.h:180:14: note: expected 'const char *' but argument is of type '__be32 *' {aka 'unsigned int *'} 180 | extern char *kmemdup_nul(const char *s, size_t len, gfp_t gfp); | ^~~~~~~~~~~ fs/nfs/pnfs_nfs.c:1108:20: error: passing argument 1 of 'kmemdup_nul' from incompatible pointer type [-Werror=incompatible-pointer-types] 1108 | buf = kmemdup_nul(p, rlen, gfp_flags); | ^ | | | __be32 * {aka unsigned int *} In file included from include/linux/bitmap.h:9, from include/linux/cpumask.h:12, from arch/x86/include/asm/cpumask.h:5, from arch/x86/include/asm/msr.h:11, from arch/x86/include/asm/processor.h:22, from arch/x86/include/asm/cpufeature.h:5, from arch/x86/include/asm/thread_info.h:53, from include/linux/thread_info.h:38, from include/linux/uio.h:9, from include/linux/socket.h:8, from include/uapi/linux/in.h:24, from include/linux/in.h:19, from include/linux/nfs_fs.h:22, from fs/nfs/pnfs_nfs.c:11: include/linux/string.h:180:14: note: expected 'const char *' but argument is of type '__be32 *' {aka 'unsigned int *'} 180 | extern char *kmemdup_nul(const char *s, size_t len, gfp_t gfp); | ^~~~~~~~~~~ cc1: some warnings being treated as errors vim +/kmemdup_nul +1088 fs/nfs/pnfs_nfs.c 1059 1060 /* 1061 * Currently only supports ipv4, ipv6 and one multi-path address. 1062 */ 1063 struct nfs4_pnfs_ds_addr * 1064 nfs4_decode_mp_ds_addr(struct net *net, struct xdr_stream *xdr, gfp_t gfp_flags) 1065 { 1066 struct nfs4_pnfs_ds_addr *da = NULL; 1067 char *buf, *portstr; 1068 __be16 port; 1069 int nlen, rlen; 1070 int tmp[2]; 1071 __be32 *p; 1072 char *netid; 1073 size_t len; 1074 char *startsep = ""; 1075 char *endsep = ""; 1076 1077 1078 /* r_netid */ 1079 p = xdr_inline_decode(xdr, 4); 1080 if (unlikely(!p)) 1081 goto out_err; 1082 nlen = be32_to_cpup(p++); 1083 1084 p = xdr_inline_decode(xdr, nlen); 1085 if (unlikely(!p)) 1086 goto out_err; 1087 > 1088 netid = kmemdup_nul(p, nlen, gfp_flags); 1089 if (unlikely(!netid)) 1090 goto out_err; 1091 1092 /* r_addr: ip/ip6addr with port in dec octets - see RFC 5665 */ 1093 p = xdr_inline_decode(xdr, 4); 1094 if (unlikely(!p)) 1095 goto out_free_netid; 1096 rlen = be32_to_cpup(p); 1097 1098 p = xdr_inline_decode(xdr, rlen); 1099 if (unlikely(!p)) 1100 goto out_free_netid; 1101 1102 /* port is ".ABC.DEF", 8 chars max */ 1103 if (rlen > INET6_ADDRSTRLEN + IPV6_SCOPE_ID_LEN + 8) { 1104 dprintk("%s: Invalid address, length %d\n", __func__, 1105 rlen); 1106 goto out_free_netid; 1107 } 1108 buf = kmemdup_nul(p, rlen, gfp_flags); 1109 if (!buf) { 1110 dprintk("%s: Not enough memory\n", __func__); 1111 goto out_free_netid; 1112 } 1113 1114 /* replace port '.' with '-' */ 1115 portstr = strrchr(buf, '.'); 1116 if (!portstr) { 1117 dprintk("%s: Failed finding expected dot in port\n", 1118 __func__); 1119 goto out_free_buf; 1120 } 1121 *portstr = '-'; 1122 1123 /* find '.' between address and port */ 1124 portstr = strrchr(buf, '.'); 1125 if (!portstr) { 1126 dprintk("%s: Failed finding expected dot between address and " 1127 "port\n", __func__); 1128 goto out_free_buf; 1129 } 1130 *portstr = '\0'; 1131 1132 da = kzalloc(sizeof(*da), gfp_flags); 1133 if (unlikely(!da)) 1134 goto out_free_buf; 1135 1136 INIT_LIST_HEAD(&da->da_node); 1137 1138 if (!rpc_pton(net, buf, portstr-buf, (struct sockaddr *)&da->da_addr, 1139 sizeof(da->da_addr))) { 1140 dprintk("%s: error parsing address %s\n", __func__, buf); 1141 goto out_free_da; 1142 } 1143 1144 portstr++; 1145 sscanf(portstr, "%d-%d", &tmp[0], &tmp[1]); 1146 port = htons((tmp[0] << 8) | (tmp[1])); 1147 1148 switch (da->da_addr.ss_family) { 1149 case AF_INET: 1150 ((struct sockaddr_in *)&da->da_addr)->sin_port = port; 1151 da->da_addrlen = sizeof(struct sockaddr_in); 1152 break; 1153 1154 case AF_INET6: 1155 ((struct sockaddr_in6 *)&da->da_addr)->sin6_port = port; 1156 da->da_addrlen = sizeof(struct sockaddr_in6); 1157 startsep = "["; 1158 endsep = "]"; 1159 break; 1160 1161 default: 1162 dprintk("%s: unsupported address family: %u\n", 1163 __func__, da->da_addr.ss_family); 1164 goto out_free_da; 1165 } 1166 1167 da->da_transport = nfs4_decode_transport(netid, nlen, 1168 da->da_addr.ss_family); 1169 if (da->da_transport == -1) { 1170 dprintk("%s: ERROR: unknown r_netid \"%*s\"\n", 1171 __func__, nlen, netid); 1172 goto out_free_da; 1173 } 1174 1175 /* save human readable address */ 1176 len = strlen(startsep) + strlen(buf) + strlen(endsep) + 7; 1177 da->da_remotestr = kzalloc(len, gfp_flags); 1178 1179 /* NULL is ok, only used for dprintk */ 1180 if (da->da_remotestr) 1181 snprintf(da->da_remotestr, len, "%s%s%s:%u", startsep, 1182 buf, endsep, ntohs(port)); 1183 1184 dprintk("%s: Parsed DS addr %s\n", __func__, da->da_remotestr); 1185 kfree(buf); 1186 kfree(netid); 1187 return da; 1188 1189 out_free_da: 1190 kfree(da); 1191 out_free_buf: 1192 dprintk("%s: Error parsing DS addr: %s\n", __func__, buf); 1193 kfree(buf); 1194 out_free_netid: 1195 kfree(netid); 1196 out_err: 1197 return NULL; 1198 } 1199 EXPORT_SYMBOL_GPL(nfs4_decode_mp_ds_addr); 1200 --- 0-DAY CI Kernel Test Service, Intel Corporation https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org