/* We have to be cautious here. We have seen BIOSes with DMI pointers pointing to completely the wrong place for example  */
static void dmi_table(u8 *buf, int len, int num, void(*decode)(const struct dmi_header *, void *), void *private_data)
/* We have to be cautious here. We have seen BIOSes with DMI pointers pointing to completely the wrong place for example  */
static void dmi_table(u8 *buf, int len, int num, void(*decode)(const struct dmi_header *, void *), void *private_data)
{
	u8 *data = buf;
	int i = 0;
	while ((i < num) && (data - buf + sizeof(struct dmi_header)) <= len) {
		const struct dmi_header *dm = (const struct dmi_header *)data;
		data += dm->length;
		while ((data - buf < len - 1) && (data[0] || data[1]))
			data++;
		if (data - buf < len - 1)
			decode(dm, private_data);
		data += 2;
		i++;
	}
}