All of lore.kernel.org
 help / color / mirror / Atom feed
From: kernel test robot <lkp@intel.com>
To: kbuild-all@lists.01.org
Subject: [jgunthorpe:pr/3 41/49] drivers/vfio/pci/vfio_pci.c:891:26: warning: variable 'pdev' is uninitialized when used within its own initialization
Date: Tue, 02 Mar 2021 12:29:55 +0800	[thread overview]
Message-ID: <202103021253.j3iCSUC7-lkp@intel.com> (raw)

[-- Attachment #1: Type: text/plain, Size: 21461 bytes --]

tree:   https://github.com/jgunthorpe/linux pr/3
head:   149ed847a48641c2da496c00eec4d077d1ce61a6
commit: a310ee236e20e2bc5defd5d5c3bec23d89c132bd [41/49] vfio/pci: Get rid of vfio_pci_device pdev
config: powerpc-randconfig-r036-20210301 (attached as .config)
compiler: clang version 13.0.0 (https://github.com/llvm/llvm-project 5de09ef02e24d234d9fc0cd1c6dfe18a1bb784b0)
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
        # https://github.com/jgunthorpe/linux/commit/a310ee236e20e2bc5defd5d5c3bec23d89c132bd
        git remote add jgunthorpe https://github.com/jgunthorpe/linux
        git fetch --no-tags jgunthorpe pr/3
        git checkout a310ee236e20e2bc5defd5d5c3bec23d89c132bd
        # 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 >>):

>> drivers/vfio/pci/vfio_pci.c:891:26: warning: variable 'pdev' is uninitialized when used within its own initialization [-Wuninitialized]
                   struct pci_dev *pdev = pdev;
                                   ~~~~   ^~~~
   1 warning generated.


vim +/pdev +891 drivers/vfio/pci/vfio_pci.c

   824	
   825	static long vfio_pci_ioctl(struct vfio_device *core_vdev,
   826				   unsigned int cmd, unsigned long arg)
   827	{
   828		struct vfio_pci_device *vdev =
   829			container_of(core_vdev, struct vfio_pci_device, vdev);
   830		struct pci_dev *pdev = to_pci_dev(vdev->vdev.dev);
   831		unsigned long minsz;
   832	
   833		if (cmd == VFIO_DEVICE_GET_INFO) {
   834			struct vfio_device_info info;
   835			struct vfio_info_cap caps = { .buf = NULL, .size = 0 };
   836			unsigned long capsz;
   837			int ret;
   838	
   839			minsz = offsetofend(struct vfio_device_info, num_irqs);
   840	
   841			/* For backward compatibility, cannot require this */
   842			capsz = offsetofend(struct vfio_iommu_type1_info, cap_offset);
   843	
   844			if (copy_from_user(&info, (void __user *)arg, minsz))
   845				return -EFAULT;
   846	
   847			if (info.argsz < minsz)
   848				return -EINVAL;
   849	
   850			if (info.argsz >= capsz) {
   851				minsz = capsz;
   852				info.cap_offset = 0;
   853			}
   854	
   855			info.flags = VFIO_DEVICE_FLAGS_PCI;
   856	
   857			if (vdev->reset_works)
   858				info.flags |= VFIO_DEVICE_FLAGS_RESET;
   859	
   860			info.num_regions = VFIO_PCI_NUM_REGIONS + vdev->num_regions;
   861			info.num_irqs = VFIO_PCI_NUM_IRQS;
   862	
   863			ret = vfio_pci_info_zdev_add_caps(vdev, &caps);
   864			if (ret && ret != -ENODEV) {
   865				pci_warn(pdev, "Failed to setup zPCI info capabilities\n");
   866				return ret;
   867			}
   868	
   869			if (caps.size) {
   870				info.flags |= VFIO_DEVICE_FLAGS_CAPS;
   871				if (info.argsz < sizeof(info) + caps.size) {
   872					info.argsz = sizeof(info) + caps.size;
   873				} else {
   874					vfio_info_cap_shift(&caps, sizeof(info));
   875					if (copy_to_user((void __user *)arg +
   876							  sizeof(info), caps.buf,
   877							  caps.size)) {
   878						kfree(caps.buf);
   879						return -EFAULT;
   880					}
   881					info.cap_offset = sizeof(info);
   882				}
   883	
   884				kfree(caps.buf);
   885			}
   886	
   887			return copy_to_user((void __user *)arg, &info, minsz) ?
   888				-EFAULT : 0;
   889	
   890		} else if (cmd == VFIO_DEVICE_GET_REGION_INFO) {
 > 891			struct pci_dev *pdev = pdev;
   892			struct vfio_region_info info;
   893			struct vfio_info_cap caps = { .buf = NULL, .size = 0 };
   894			int i, ret;
   895	
   896			minsz = offsetofend(struct vfio_region_info, offset);
   897	
   898			if (copy_from_user(&info, (void __user *)arg, minsz))
   899				return -EFAULT;
   900	
   901			if (info.argsz < minsz)
   902				return -EINVAL;
   903	
   904			switch (info.index) {
   905			case VFIO_PCI_CONFIG_REGION_INDEX:
   906				info.offset = VFIO_PCI_INDEX_TO_OFFSET(info.index);
   907				info.size = pdev->cfg_size;
   908				info.flags = VFIO_REGION_INFO_FLAG_READ |
   909					     VFIO_REGION_INFO_FLAG_WRITE;
   910				break;
   911			case VFIO_PCI_BAR0_REGION_INDEX ... VFIO_PCI_BAR5_REGION_INDEX:
   912				info.offset = VFIO_PCI_INDEX_TO_OFFSET(info.index);
   913				info.size = pci_resource_len(pdev, info.index);
   914				if (!info.size) {
   915					info.flags = 0;
   916					break;
   917				}
   918	
   919				info.flags = VFIO_REGION_INFO_FLAG_READ |
   920					     VFIO_REGION_INFO_FLAG_WRITE;
   921				if (vdev->bar_mmap_supported[info.index]) {
   922					info.flags |= VFIO_REGION_INFO_FLAG_MMAP;
   923					if (info.index == vdev->msix_bar) {
   924						ret = msix_mmappable_cap(vdev, &caps);
   925						if (ret)
   926							return ret;
   927					}
   928				}
   929	
   930				break;
   931			case VFIO_PCI_ROM_REGION_INDEX:
   932			{
   933				void __iomem *io;
   934				size_t size;
   935				u16 cmd;
   936	
   937				info.offset = VFIO_PCI_INDEX_TO_OFFSET(info.index);
   938				info.flags = 0;
   939	
   940				/* Report the BAR size, not the ROM size */
   941				info.size = pci_resource_len(pdev, info.index);
   942				if (!info.size) {
   943					/* Shadow ROMs appear as PCI option ROMs */
   944					if (pdev->resource[PCI_ROM_RESOURCE].flags &
   945								IORESOURCE_ROM_SHADOW)
   946						info.size = 0x20000;
   947					else
   948						break;
   949				}
   950	
   951				/*
   952				 * Is it really there?  Enable memory decode for
   953				 * implicit access in pci_map_rom().
   954				 */
   955				cmd = vfio_pci_memory_lock_and_enable(vdev);
   956				io = pci_map_rom(pdev, &size);
   957				if (io) {
   958					info.flags = VFIO_REGION_INFO_FLAG_READ;
   959					pci_unmap_rom(pdev, io);
   960				} else {
   961					info.size = 0;
   962				}
   963				vfio_pci_memory_unlock_and_restore(vdev, cmd);
   964	
   965				break;
   966			}
   967			case VFIO_PCI_VGA_REGION_INDEX:
   968				if (!vdev->has_vga)
   969					return -EINVAL;
   970	
   971				info.offset = VFIO_PCI_INDEX_TO_OFFSET(info.index);
   972				info.size = 0xc0000;
   973				info.flags = VFIO_REGION_INFO_FLAG_READ |
   974					     VFIO_REGION_INFO_FLAG_WRITE;
   975	
   976				break;
   977			default:
   978			{
   979				struct vfio_region_info_cap_type cap_type = {
   980						.header.id = VFIO_REGION_INFO_CAP_TYPE,
   981						.header.version = 1 };
   982	
   983				if (info.index >=
   984				    VFIO_PCI_NUM_REGIONS + vdev->num_regions)
   985					return -EINVAL;
   986				info.index = array_index_nospec(info.index,
   987								VFIO_PCI_NUM_REGIONS +
   988								vdev->num_regions);
   989	
   990				i = info.index - VFIO_PCI_NUM_REGIONS;
   991	
   992				info.offset = VFIO_PCI_INDEX_TO_OFFSET(info.index);
   993				info.size = vdev->region[i].size;
   994				info.flags = vdev->region[i].flags;
   995	
   996				cap_type.type = vdev->region[i].type;
   997				cap_type.subtype = vdev->region[i].subtype;
   998	
   999				ret = vfio_info_add_capability(&caps, &cap_type.header,
  1000							       sizeof(cap_type));
  1001				if (ret)
  1002					return ret;
  1003	
  1004				if (vdev->region[i].ops->add_capability) {
  1005					ret = vdev->region[i].ops->add_capability(vdev,
  1006							&vdev->region[i], &caps);
  1007					if (ret)
  1008						return ret;
  1009				}
  1010			}
  1011			}
  1012	
  1013			if (caps.size) {
  1014				info.flags |= VFIO_REGION_INFO_FLAG_CAPS;
  1015				if (info.argsz < sizeof(info) + caps.size) {
  1016					info.argsz = sizeof(info) + caps.size;
  1017					info.cap_offset = 0;
  1018				} else {
  1019					vfio_info_cap_shift(&caps, sizeof(info));
  1020					if (copy_to_user((void __user *)arg +
  1021							  sizeof(info), caps.buf,
  1022							  caps.size)) {
  1023						kfree(caps.buf);
  1024						return -EFAULT;
  1025					}
  1026					info.cap_offset = sizeof(info);
  1027				}
  1028	
  1029				kfree(caps.buf);
  1030			}
  1031	
  1032			return copy_to_user((void __user *)arg, &info, minsz) ?
  1033				-EFAULT : 0;
  1034	
  1035		} else if (cmd == VFIO_DEVICE_GET_IRQ_INFO) {
  1036			struct vfio_irq_info info;
  1037	
  1038			minsz = offsetofend(struct vfio_irq_info, count);
  1039	
  1040			if (copy_from_user(&info, (void __user *)arg, minsz))
  1041				return -EFAULT;
  1042	
  1043			if (info.argsz < minsz || info.index >= VFIO_PCI_NUM_IRQS)
  1044				return -EINVAL;
  1045	
  1046			switch (info.index) {
  1047			case VFIO_PCI_INTX_IRQ_INDEX ... VFIO_PCI_MSIX_IRQ_INDEX:
  1048			case VFIO_PCI_REQ_IRQ_INDEX:
  1049				break;
  1050			case VFIO_PCI_ERR_IRQ_INDEX:
  1051				if (pci_is_pcie(pdev))
  1052					break;
  1053				fallthrough;
  1054			default:
  1055				return -EINVAL;
  1056			}
  1057	
  1058			info.flags = VFIO_IRQ_INFO_EVENTFD;
  1059	
  1060			info.count = vfio_pci_get_irq_count(vdev, info.index);
  1061	
  1062			if (info.index == VFIO_PCI_INTX_IRQ_INDEX)
  1063				info.flags |= (VFIO_IRQ_INFO_MASKABLE |
  1064					       VFIO_IRQ_INFO_AUTOMASKED);
  1065			else
  1066				info.flags |= VFIO_IRQ_INFO_NORESIZE;
  1067	
  1068			return copy_to_user((void __user *)arg, &info, minsz) ?
  1069				-EFAULT : 0;
  1070	
  1071		} else if (cmd == VFIO_DEVICE_SET_IRQS) {
  1072			struct vfio_irq_set hdr;
  1073			u8 *data = NULL;
  1074			int max, ret = 0;
  1075			size_t data_size = 0;
  1076	
  1077			minsz = offsetofend(struct vfio_irq_set, count);
  1078	
  1079			if (copy_from_user(&hdr, (void __user *)arg, minsz))
  1080				return -EFAULT;
  1081	
  1082			max = vfio_pci_get_irq_count(vdev, hdr.index);
  1083	
  1084			ret = vfio_set_irqs_validate_and_prepare(&hdr, max,
  1085							 VFIO_PCI_NUM_IRQS, &data_size);
  1086			if (ret)
  1087				return ret;
  1088	
  1089			if (data_size) {
  1090				data = memdup_user((void __user *)(arg + minsz),
  1091						    data_size);
  1092				if (IS_ERR(data))
  1093					return PTR_ERR(data);
  1094			}
  1095	
  1096			mutex_lock(&vdev->igate);
  1097	
  1098			ret = vfio_pci_set_irqs_ioctl(vdev, hdr.flags, hdr.index,
  1099						      hdr.start, hdr.count, data);
  1100	
  1101			mutex_unlock(&vdev->igate);
  1102			kfree(data);
  1103	
  1104			return ret;
  1105	
  1106		} else if (cmd == VFIO_DEVICE_RESET) {
  1107			int ret;
  1108	
  1109			if (!vdev->reset_works)
  1110				return -EINVAL;
  1111	
  1112			vfio_pci_zap_and_down_write_memory_lock(vdev);
  1113			ret = pci_try_reset_function(pdev);
  1114			up_write(&vdev->memory_lock);
  1115	
  1116			return ret;
  1117	
  1118		} else if (cmd == VFIO_DEVICE_GET_PCI_HOT_RESET_INFO) {
  1119			struct vfio_pci_hot_reset_info hdr;
  1120			struct vfio_pci_fill_info fill = { 0 };
  1121			struct vfio_pci_dependent_device *devices = NULL;
  1122			bool slot = false;
  1123			int ret = 0;
  1124	
  1125			minsz = offsetofend(struct vfio_pci_hot_reset_info, count);
  1126	
  1127			if (copy_from_user(&hdr, (void __user *)arg, minsz))
  1128				return -EFAULT;
  1129	
  1130			if (hdr.argsz < minsz)
  1131				return -EINVAL;
  1132	
  1133			hdr.flags = 0;
  1134	
  1135			/* Can we do a slot or bus reset or neither? */
  1136			if (!pci_probe_reset_slot(pdev->slot))
  1137				slot = true;
  1138			else if (pci_probe_reset_bus(pdev->bus))
  1139				return -ENODEV;
  1140	
  1141			/* How many devices are affected? */
  1142			ret = vfio_pci_for_each_slot_or_bus(pdev,
  1143							    vfio_pci_count_devs,
  1144							    &fill.max, slot);
  1145			if (ret)
  1146				return ret;
  1147	
  1148			WARN_ON(!fill.max); /* Should always be at least one */
  1149	
  1150			/*
  1151			 * If there's enough space, fill it now, otherwise return
  1152			 * -ENOSPC and the number of devices affected.
  1153			 */
  1154			if (hdr.argsz < sizeof(hdr) + (fill.max * sizeof(*devices))) {
  1155				ret = -ENOSPC;
  1156				hdr.count = fill.max;
  1157				goto reset_info_exit;
  1158			}
  1159	
  1160			devices = kcalloc(fill.max, sizeof(*devices), GFP_KERNEL);
  1161			if (!devices)
  1162				return -ENOMEM;
  1163	
  1164			fill.devices = devices;
  1165	
  1166			ret = vfio_pci_for_each_slot_or_bus(pdev,
  1167							    vfio_pci_fill_devs,
  1168							    &fill, slot);
  1169	
  1170			/*
  1171			 * If a device was removed between counting and filling,
  1172			 * we may come up short of fill.max.  If a device was
  1173			 * added, we'll have a return of -EAGAIN above.
  1174			 */
  1175			if (!ret)
  1176				hdr.count = fill.cur;
  1177	
  1178	reset_info_exit:
  1179			if (copy_to_user((void __user *)arg, &hdr, minsz))
  1180				ret = -EFAULT;
  1181	
  1182			if (!ret) {
  1183				if (copy_to_user((void __user *)(arg + minsz), devices,
  1184						 hdr.count * sizeof(*devices)))
  1185					ret = -EFAULT;
  1186			}
  1187	
  1188			kfree(devices);
  1189			return ret;
  1190	
  1191		} else if (cmd == VFIO_DEVICE_PCI_HOT_RESET) {
  1192			struct vfio_pci_hot_reset hdr;
  1193			int32_t *group_fds;
  1194			struct vfio_pci_group_entry *groups;
  1195			struct vfio_pci_group_info info;
  1196			struct vfio_devices devs = { .cur_index = 0 };
  1197			bool slot = false;
  1198			int i, group_idx, mem_idx = 0, count = 0, ret = 0;
  1199	
  1200			minsz = offsetofend(struct vfio_pci_hot_reset, count);
  1201	
  1202			if (copy_from_user(&hdr, (void __user *)arg, minsz))
  1203				return -EFAULT;
  1204	
  1205			if (hdr.argsz < minsz || hdr.flags)
  1206				return -EINVAL;
  1207	
  1208			/* Can we do a slot or bus reset or neither? */
  1209			if (!pci_probe_reset_slot(pdev->slot))
  1210				slot = true;
  1211			else if (pci_probe_reset_bus(pdev->bus))
  1212				return -ENODEV;
  1213	
  1214			/*
  1215			 * We can't let userspace give us an arbitrarily large
  1216			 * buffer to copy, so verify how many we think there
  1217			 * could be.  Note groups can have multiple devices so
  1218			 * one group per device is the max.
  1219			 */
  1220			ret = vfio_pci_for_each_slot_or_bus(pdev,
  1221							    vfio_pci_count_devs,
  1222							    &count, slot);
  1223			if (ret)
  1224				return ret;
  1225	
  1226			/* Somewhere between 1 and count is OK */
  1227			if (!hdr.count || hdr.count > count)
  1228				return -EINVAL;
  1229	
  1230			group_fds = kcalloc(hdr.count, sizeof(*group_fds), GFP_KERNEL);
  1231			groups = kcalloc(hdr.count, sizeof(*groups), GFP_KERNEL);
  1232			if (!group_fds || !groups) {
  1233				kfree(group_fds);
  1234				kfree(groups);
  1235				return -ENOMEM;
  1236			}
  1237	
  1238			if (copy_from_user(group_fds, (void __user *)(arg + minsz),
  1239					   hdr.count * sizeof(*group_fds))) {
  1240				kfree(group_fds);
  1241				kfree(groups);
  1242				return -EFAULT;
  1243			}
  1244	
  1245			/*
  1246			 * For each group_fd, get the group through the vfio external
  1247			 * user interface and store the group and iommu ID.  This
  1248			 * ensures the group is held across the reset.
  1249			 */
  1250			for (group_idx = 0; group_idx < hdr.count; group_idx++) {
  1251				struct vfio_group *group;
  1252				struct fd f = fdget(group_fds[group_idx]);
  1253				if (!f.file) {
  1254					ret = -EBADF;
  1255					break;
  1256				}
  1257	
  1258				group = vfio_group_get_external_user(f.file);
  1259				fdput(f);
  1260				if (IS_ERR(group)) {
  1261					ret = PTR_ERR(group);
  1262					break;
  1263				}
  1264	
  1265				groups[group_idx].group = group;
  1266				groups[group_idx].id =
  1267						vfio_external_user_iommu_id(group);
  1268			}
  1269	
  1270			kfree(group_fds);
  1271	
  1272			/* release reference to groups on error */
  1273			if (ret)
  1274				goto hot_reset_release;
  1275	
  1276			info.count = hdr.count;
  1277			info.groups = groups;
  1278	
  1279			/*
  1280			 * Test whether all the affected devices are contained
  1281			 * by the set of groups provided by the user.
  1282			 */
  1283			ret = vfio_pci_for_each_slot_or_bus(pdev,
  1284							    vfio_pci_validate_devs,
  1285							    &info, slot);
  1286			if (ret)
  1287				goto hot_reset_release;
  1288	
  1289			devs.max_index = count;
  1290			devs.devices = kcalloc(count, sizeof(struct vfio_device *),
  1291					       GFP_KERNEL);
  1292			if (!devs.devices) {
  1293				ret = -ENOMEM;
  1294				goto hot_reset_release;
  1295			}
  1296	
  1297			/*
  1298			 * We need to get memory_lock for each device, but devices
  1299			 * can share mmap_lock, therefore we need to zap and hold
  1300			 * the vma_lock for each device, and only then get each
  1301			 * memory_lock.
  1302			 */
  1303			ret = vfio_pci_for_each_slot_or_bus(pdev,
  1304						    vfio_pci_try_zap_and_vma_lock_cb,
  1305						    &devs, slot);
  1306			if (ret)
  1307				goto hot_reset_release;
  1308	
  1309			for (; mem_idx < devs.cur_index; mem_idx++) {
  1310				struct vfio_pci_device *tmp = devs.devices[mem_idx];
  1311	
  1312				ret = down_write_trylock(&tmp->memory_lock);
  1313				if (!ret) {
  1314					ret = -EBUSY;
  1315					goto hot_reset_release;
  1316				}
  1317				mutex_unlock(&tmp->vma_lock);
  1318			}
  1319	
  1320			/* User has access, do the reset */
  1321			ret = pci_reset_bus(pdev);
  1322	
  1323	hot_reset_release:
  1324			for (i = 0; i < devs.cur_index; i++) {
  1325				struct vfio_pci_device *tmp = devs.devices[i];
  1326	
  1327				if (i < mem_idx)
  1328					up_write(&tmp->memory_lock);
  1329				else
  1330					mutex_unlock(&tmp->vma_lock);
  1331				vfio_device_put(&tmp->vdev);
  1332			}
  1333			kfree(devs.devices);
  1334	
  1335			for (group_idx--; group_idx >= 0; group_idx--)
  1336				vfio_group_put_external_user(groups[group_idx].group);
  1337	
  1338			kfree(groups);
  1339			return ret;
  1340		} else if (cmd == VFIO_DEVICE_IOEVENTFD) {
  1341			struct vfio_device_ioeventfd ioeventfd;
  1342			int count;
  1343	
  1344			minsz = offsetofend(struct vfio_device_ioeventfd, fd);
  1345	
  1346			if (copy_from_user(&ioeventfd, (void __user *)arg, minsz))
  1347				return -EFAULT;
  1348	
  1349			if (ioeventfd.argsz < minsz)
  1350				return -EINVAL;
  1351	
  1352			if (ioeventfd.flags & ~VFIO_DEVICE_IOEVENTFD_SIZE_MASK)
  1353				return -EINVAL;
  1354	
  1355			count = ioeventfd.flags & VFIO_DEVICE_IOEVENTFD_SIZE_MASK;
  1356	
  1357			if (hweight8(count) != 1 || ioeventfd.fd < -1)
  1358				return -EINVAL;
  1359	
  1360			return vfio_pci_ioeventfd(vdev, ioeventfd.offset,
  1361						  ioeventfd.data, count, ioeventfd.fd);
  1362		} else if (cmd == VFIO_DEVICE_FEATURE) {
  1363			struct vfio_device_feature feature;
  1364			uuid_t uuid;
  1365	
  1366			minsz = offsetofend(struct vfio_device_feature, flags);
  1367	
  1368			if (copy_from_user(&feature, (void __user *)arg, minsz))
  1369				return -EFAULT;
  1370	
  1371			if (feature.argsz < minsz)
  1372				return -EINVAL;
  1373	
  1374			/* Check unknown flags */
  1375			if (feature.flags & ~(VFIO_DEVICE_FEATURE_MASK |
  1376					      VFIO_DEVICE_FEATURE_SET |
  1377					      VFIO_DEVICE_FEATURE_GET |
  1378					      VFIO_DEVICE_FEATURE_PROBE))
  1379				return -EINVAL;
  1380	
  1381			/* GET & SET are mutually exclusive except with PROBE */
  1382			if (!(feature.flags & VFIO_DEVICE_FEATURE_PROBE) &&
  1383			    (feature.flags & VFIO_DEVICE_FEATURE_SET) &&
  1384			    (feature.flags & VFIO_DEVICE_FEATURE_GET))
  1385				return -EINVAL;
  1386	
  1387			switch (feature.flags & VFIO_DEVICE_FEATURE_MASK) {
  1388			case VFIO_DEVICE_FEATURE_PCI_VF_TOKEN:
  1389				if (!vdev->vf_token)
  1390					return -ENOTTY;
  1391	
  1392				/*
  1393				 * We do not support GET of the VF Token UUID as this
  1394				 * could expose the token of the previous device user.
  1395				 */
  1396				if (feature.flags & VFIO_DEVICE_FEATURE_GET)
  1397					return -EINVAL;
  1398	
  1399				if (feature.flags & VFIO_DEVICE_FEATURE_PROBE)
  1400					return 0;
  1401	
  1402				/* Don't SET unless told to do so */
  1403				if (!(feature.flags & VFIO_DEVICE_FEATURE_SET))
  1404					return -EINVAL;
  1405	
  1406				if (feature.argsz < minsz + sizeof(uuid))
  1407					return -EINVAL;
  1408	
  1409				if (copy_from_user(&uuid, (void __user *)(arg + minsz),
  1410						   sizeof(uuid)))
  1411					return -EFAULT;
  1412	
  1413				mutex_lock(&vdev->vf_token->lock);
  1414				uuid_copy(&vdev->vf_token->uuid, &uuid);
  1415				mutex_unlock(&vdev->vf_token->lock);
  1416	
  1417				return 0;
  1418			default:
  1419				return -ENOTTY;
  1420			}
  1421		}
  1422	
  1423		return -ENOTTY;
  1424	}
  1425	

---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all(a)lists.01.org

[-- Attachment #2: config.gz --]
[-- Type: application/gzip, Size: 44975 bytes --]

                 reply	other threads:[~2021-03-02  4:29 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=202103021253.j3iCSUC7-lkp@intel.com \
    --to=lkp@intel.com \
    --cc=kbuild-all@lists.01.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.