tree: https://git.kernel.org/pub/scm/linux/kernel/git/mkl/linux-can-next.git testing head: 6a89c9390e62e16ede591ae920b38e276207f1a4 commit: 99b153b74559d9e3a6456ea5f0eaae03c8dcad79 [8/17] can: add ISO 15765-2:2016 transport protocol config: x86_64-randconfig-m001-20201005 (attached as .config) compiler: gcc-9 (Debian 9.3.0-15) 9.3.0 If you fix the issue, kindly add following tag as appropriate Reported-by: kernel test robot <lkp@xxxxxxxxx> smatch warnings: net/can/isotp.c:1159 isotp_setsockopt() warn: unsigned 'optlen' is never less than zero. vim +/optlen +1159 net/can/isotp.c 1149 1150 static int isotp_setsockopt(struct socket *sock, int level, int optname, 1151 sockptr_t optval, unsigned int optlen) 1152 { 1153 struct sock *sk = sock->sk; 1154 struct isotp_sock *so = isotp_sk(sk); 1155 int ret = 0; 1156 1157 if (level != SOL_CAN_ISOTP) 1158 return -EINVAL; > 1159 if (optlen < 0) 1160 return -EINVAL; 1161 1162 switch (optname) { 1163 case CAN_ISOTP_OPTS: 1164 if (optlen != sizeof(struct can_isotp_options)) 1165 return -EINVAL; 1166 1167 if (copy_from_sockptr(&so->opt, optval, optlen)) 1168 return -EFAULT; 1169 1170 /* no separate rx_ext_address is given => use ext_address */ 1171 if (!(so->opt.flags & CAN_ISOTP_RX_EXT_ADDR)) 1172 so->opt.rx_ext_address = so->opt.ext_address; 1173 break; 1174 1175 case CAN_ISOTP_RECV_FC: 1176 if (optlen != sizeof(struct can_isotp_fc_options)) 1177 return -EINVAL; 1178 1179 if (copy_from_sockptr(&so->rxfc, optval, optlen)) 1180 return -EFAULT; 1181 break; 1182 1183 case CAN_ISOTP_TX_STMIN: 1184 if (optlen != sizeof(__u32)) 1185 return -EINVAL; 1186 1187 if (copy_from_sockptr(&so->force_tx_stmin, optval, optlen)) 1188 return -EFAULT; 1189 break; 1190 1191 case CAN_ISOTP_RX_STMIN: 1192 if (optlen != sizeof(__u32)) 1193 return -EINVAL; 1194 1195 if (copy_from_sockptr(&so->force_rx_stmin, optval, optlen)) 1196 return -EFAULT; 1197 break; 1198 1199 case CAN_ISOTP_LL_OPTS: 1200 if (optlen == sizeof(struct can_isotp_ll_options)) { 1201 struct can_isotp_ll_options ll; 1202 1203 if (copy_from_sockptr(&ll, optval, optlen)) 1204 return -EFAULT; 1205 1206 /* check for correct ISO 11898-1 DLC data length */ 1207 if (ll.tx_dl != padlen(ll.tx_dl)) 1208 return -EINVAL; 1209 1210 if (ll.mtu != CAN_MTU && ll.mtu != CANFD_MTU) 1211 return -EINVAL; 1212 1213 if (ll.mtu == CAN_MTU && ll.tx_dl > CAN_MAX_DLEN) 1214 return -EINVAL; 1215 1216 memcpy(&so->ll, &ll, sizeof(ll)); 1217 1218 /* set ll_dl for tx path to similar place as for rx */ 1219 so->tx.ll_dl = ll.tx_dl; 1220 } else { 1221 return -EINVAL; 1222 } 1223 break; 1224 1225 default: 1226 ret = -ENOPROTOOPT; 1227 } 1228 1229 return ret; 1230 } 1231 --- 0-DAY CI Kernel Test Service, Intel Corporation https://lists.01.org/hyperkitty/list/kbuild-all@xxxxxxxxxxxx
Attachment:
.config.gz
Description: application/gzip