Hi shamir, Thank you for the patch! Perhaps something to improve: [auto build test WARNING on next-20181211] url: https://github.com/0day-ci/linux/commits/Shamir-Rabinovitch/net-rds-fix-warn-in-rds_message_alloc_sgs/20181212-111048 config: x86_64-allmodconfig (attached as .config) compiler: gcc-7 (Debian 7.3.0-1) 7.3.0 reproduce: # save the attached .config to linux build tree make ARCH=x86_64 All warnings (new ones prefixed by >>): net/rds/send.c:1038:24: warning: incorrect type in argument 1 (different base types) net/rds/send.c:1038:24: expected unsigned int [unsigned] [usertype] a net/rds/send.c:1038:24: got restricted __be16 [usertype] sin6_port net/rds/send.c:1040:24: warning: incorrect type in argument 1 (different base types) net/rds/send.c:1040:24: expected unsigned int [unsigned] [usertype] a net/rds/send.c:1040:24: got restricted __be16 [usertype] sin6_port >> net/rds/send.c:1109:42: warning: Using plain integer as NULL pointer net/rds/send.c:1446:30: warning: incorrect type in initializer (different base types) net/rds/send.c:1446:30: expected unsigned short [unsigned] [usertype] npaths net/rds/send.c:1446:30: got restricted __be16 [usertype] <noident> net/rds/send.c:1447:34: warning: incorrect type in initializer (different base types) net/rds/send.c:1447:34: expected unsigned int [unsigned] [usertype] my_gen_num net/rds/send.c:1447:34: got restricted __be32 [usertype] <noident> vim +1109 net/rds/send.c 5c1155904 Andy Grover 2009-02-24 1031 9a4890bd6 Ka-Cheong Poon 2018-10-08 1032 static int rds_send_mprds_hash(struct rds_sock *rs, 9a4890bd6 Ka-Cheong Poon 2018-10-08 1033 struct rds_connection *conn, int nonblock) 5916e2c15 Sowmini Varadhan 2016-07-14 1034 { 5916e2c15 Sowmini Varadhan 2016-07-14 1035 int hash; 5916e2c15 Sowmini Varadhan 2016-07-14 1036 5916e2c15 Sowmini Varadhan 2016-07-14 1037 if (conn->c_npaths == 0) 5916e2c15 Sowmini Varadhan 2016-07-14 @1038 hash = RDS_MPATH_HASH(rs, RDS_MPATH_WORKERS); 5916e2c15 Sowmini Varadhan 2016-07-14 1039 else 5916e2c15 Sowmini Varadhan 2016-07-14 1040 hash = RDS_MPATH_HASH(rs, conn->c_npaths); 5916e2c15 Sowmini Varadhan 2016-07-14 1041 if (conn->c_npaths == 0 && hash != 0) { 69b92b5b7 Sowmini Varadhan 2017-06-21 1042 rds_send_ping(conn, 0); 5916e2c15 Sowmini Varadhan 2016-07-14 1043 a43cced9a Ka-Cheong Poon 2018-04-11 1044 /* The underlying connection is not up yet. Need to wait a43cced9a Ka-Cheong Poon 2018-04-11 1045 * until it is up to be sure that the non-zero c_path can be a43cced9a Ka-Cheong Poon 2018-04-11 1046 * used. But if we are interrupted, we have to use the zero a43cced9a Ka-Cheong Poon 2018-04-11 1047 * c_path in case the connection ends up being non-MP capable. a43cced9a Ka-Cheong Poon 2018-04-11 1048 */ 9a4890bd6 Ka-Cheong Poon 2018-10-08 1049 if (conn->c_npaths == 0) { 9a4890bd6 Ka-Cheong Poon 2018-10-08 1050 /* Cannot wait for the connection be made, so just use 9a4890bd6 Ka-Cheong Poon 2018-10-08 1051 * the base c_path. 9a4890bd6 Ka-Cheong Poon 2018-10-08 1052 */ 9a4890bd6 Ka-Cheong Poon 2018-10-08 1053 if (nonblock) 9a4890bd6 Ka-Cheong Poon 2018-10-08 1054 return 0; a43cced9a Ka-Cheong Poon 2018-04-11 1055 if (wait_event_interruptible(conn->c_hs_waitq, a43cced9a Ka-Cheong Poon 2018-04-11 1056 conn->c_npaths != 0)) a43cced9a Ka-Cheong Poon 2018-04-11 1057 hash = 0; 9a4890bd6 Ka-Cheong Poon 2018-10-08 1058 } 5916e2c15 Sowmini Varadhan 2016-07-14 1059 if (conn->c_npaths == 1) 5916e2c15 Sowmini Varadhan 2016-07-14 1060 hash = 0; 5916e2c15 Sowmini Varadhan 2016-07-14 1061 } 5916e2c15 Sowmini Varadhan 2016-07-14 1062 return hash; 5916e2c15 Sowmini Varadhan 2016-07-14 1063 } 5916e2c15 Sowmini Varadhan 2016-07-14 1064 f9fb69adb Avinash Repaka 2016-02-29 1065 static int rds_rdma_bytes(struct msghdr *msg, size_t *rdma_bytes) f9fb69adb Avinash Repaka 2016-02-29 1066 { f9fb69adb Avinash Repaka 2016-02-29 1067 struct rds_rdma_args *args; f9fb69adb Avinash Repaka 2016-02-29 1068 struct cmsghdr *cmsg; f9fb69adb Avinash Repaka 2016-02-29 1069 f9fb69adb Avinash Repaka 2016-02-29 1070 for_each_cmsghdr(cmsg, msg) { f9fb69adb Avinash Repaka 2016-02-29 1071 if (!CMSG_OK(msg, cmsg)) f9fb69adb Avinash Repaka 2016-02-29 1072 return -EINVAL; f9fb69adb Avinash Repaka 2016-02-29 1073 f9fb69adb Avinash Repaka 2016-02-29 1074 if (cmsg->cmsg_level != SOL_RDS) f9fb69adb Avinash Repaka 2016-02-29 1075 continue; f9fb69adb Avinash Repaka 2016-02-29 1076 f9fb69adb Avinash Repaka 2016-02-29 1077 if (cmsg->cmsg_type == RDS_CMSG_RDMA_ARGS) { 14e138a86 Avinash Repaka 2017-12-21 1078 if (cmsg->cmsg_len < 14e138a86 Avinash Repaka 2017-12-21 1079 CMSG_LEN(sizeof(struct rds_rdma_args))) 14e138a86 Avinash Repaka 2017-12-21 1080 return -EINVAL; f9fb69adb Avinash Repaka 2016-02-29 1081 args = CMSG_DATA(cmsg); f9fb69adb Avinash Repaka 2016-02-29 1082 *rdma_bytes += args->remote_vec.bytes; f9fb69adb Avinash Repaka 2016-02-29 1083 } f9fb69adb Avinash Repaka 2016-02-29 1084 } f9fb69adb Avinash Repaka 2016-02-29 1085 return 0; f9fb69adb Avinash Repaka 2016-02-29 1086 } f9fb69adb Avinash Repaka 2016-02-29 1087 1b7841404 Ying Xue 2015-03-02 1088 int rds_sendmsg(struct socket *sock, struct msghdr *msg, size_t payload_len) 5c1155904 Andy Grover 2009-02-24 1089 { 5c1155904 Andy Grover 2009-02-24 1090 struct sock *sk = sock->sk; 5c1155904 Andy Grover 2009-02-24 1091 struct rds_sock *rs = rds_sk_to_rs(sk); eee2fa6ab Ka-Cheong Poon 2018-07-23 1092 DECLARE_SOCKADDR(struct sockaddr_in6 *, sin6, msg->msg_name); 342dfc306 Steffen Hurrle 2014-01-17 1093 DECLARE_SOCKADDR(struct sockaddr_in *, usin, msg->msg_name); 5c1155904 Andy Grover 2009-02-24 1094 __be16 dport; 5c1155904 Andy Grover 2009-02-24 1095 struct rds_message *rm = NULL; 5c1155904 Andy Grover 2009-02-24 1096 struct rds_connection *conn; 5c1155904 Andy Grover 2009-02-24 1097 int ret = 0; 5c1155904 Andy Grover 2009-02-24 1098 int queued = 0, allocated_mr = 0; 5c1155904 Andy Grover 2009-02-24 1099 int nonblock = msg->msg_flags & MSG_DONTWAIT; 1123fd734 Andy Grover 2010-03-11 1100 long timeo = sock_sndtimeo(sk, nonblock); 780a6d9e1 Sowmini Varadhan 2016-06-13 1101 struct rds_conn_path *cpath; eee2fa6ab Ka-Cheong Poon 2018-07-23 1102 struct in6_addr daddr; eee2fa6ab Ka-Cheong Poon 2018-07-23 1103 __u32 scope_id = 0; f9fb69adb Avinash Repaka 2016-02-29 1104 size_t total_payload_len = payload_len, rdma_payload_len = 0; 0cebaccef Sowmini Varadhan 2018-02-15 1105 bool zcopy = ((msg->msg_flags & MSG_ZEROCOPY) && 0cebaccef Sowmini Varadhan 2018-02-15 1106 sock_flag(rds_rs_to_sk(rs), SOCK_ZEROCOPY)); 0cebaccef Sowmini Varadhan 2018-02-15 1107 int num_sgs = ceil(payload_len, PAGE_SIZE); eee2fa6ab Ka-Cheong Poon 2018-07-23 1108 int namelen; 158503f03 shamir rabinovitch 2018-12-11 @1109 struct rds_iov_vector_arr vct = {0}; 158503f03 shamir rabinovitch 2018-12-11 1110 int ind; 158503f03 shamir rabinovitch 2018-12-11 1111 158503f03 shamir rabinovitch 2018-12-11 1112 /* expect 1 RDMA CMSG per rds_sendmsg. can still grow if more needed. */ 158503f03 shamir rabinovitch 2018-12-11 1113 vct.incr = 1; 5c1155904 Andy Grover 2009-02-24 1114 5c1155904 Andy Grover 2009-02-24 1115 /* Mirror Linux UDP mirror of BSD error message compatibility */ 5c1155904 Andy Grover 2009-02-24 1116 /* XXX: Perhaps MSG_MORE someday */ 0cebaccef Sowmini Varadhan 2018-02-15 1117 if (msg->msg_flags & ~(MSG_DONTWAIT | MSG_CMSG_COMPAT | MSG_ZEROCOPY)) { 5c1155904 Andy Grover 2009-02-24 1118 ret = -EOPNOTSUPP; 5c1155904 Andy Grover 2009-02-24 1119 goto out; 5c1155904 Andy Grover 2009-02-24 1120 } 5c1155904 Andy Grover 2009-02-24 1121 eee2fa6ab Ka-Cheong Poon 2018-07-23 1122 namelen = msg->msg_namelen; eee2fa6ab Ka-Cheong Poon 2018-07-23 1123 if (namelen != 0) { eee2fa6ab Ka-Cheong Poon 2018-07-23 1124 if (namelen < sizeof(*usin)) { 5c1155904 Andy Grover 2009-02-24 1125 ret = -EINVAL; 5c1155904 Andy Grover 2009-02-24 1126 goto out; 5c1155904 Andy Grover 2009-02-24 1127 } 1e2b44e78 Ka-Cheong Poon 2018-07-23 1128 switch (usin->sin_family) { 1e2b44e78 Ka-Cheong Poon 2018-07-23 1129 case AF_INET: 1e2b44e78 Ka-Cheong Poon 2018-07-23 1130 if (usin->sin_addr.s_addr == htonl(INADDR_ANY) || eee2fa6ab Ka-Cheong Poon 2018-07-23 1131 usin->sin_addr.s_addr == htonl(INADDR_BROADCAST) || eee2fa6ab Ka-Cheong Poon 2018-07-23 1132 IN_MULTICAST(ntohl(usin->sin_addr.s_addr))) { eee2fa6ab Ka-Cheong Poon 2018-07-23 1133 ret = -EINVAL; eee2fa6ab Ka-Cheong Poon 2018-07-23 1134 goto out; eee2fa6ab Ka-Cheong Poon 2018-07-23 1135 } eee2fa6ab Ka-Cheong Poon 2018-07-23 1136 ipv6_addr_set_v4mapped(usin->sin_addr.s_addr, &daddr); 5c1155904 Andy Grover 2009-02-24 1137 dport = usin->sin_port; eee2fa6ab Ka-Cheong Poon 2018-07-23 1138 break; eee2fa6ab Ka-Cheong Poon 2018-07-23 1139 :::::: The code at line 1109 was first introduced by commit :::::: 158503f0371c4c34918e8fef2907724818d1d02d net/rds: fix warn in rds_message_alloc_sgs :::::: TO: shamir rabinovitch <shamir.rabinovitch@xxxxxxxxxx> :::::: CC: 0day robot <lkp@xxxxxxxxx> --- 0-DAY kernel test infrastructure Open Source Technology Center https://lists.01.org/pipermail/kbuild-all Intel Corporation
Attachment:
.config.gz
Description: application/gzip