static int escd_proc_show()

in pnpbios/proc.c [65:104]


static int escd_proc_show(struct seq_file *m, void *v)
{
	struct escd_info_struc escd;
	char *tmpbuf;
	int escd_size;

	if (pnp_bios_escd_info(&escd))
		return -EIO;

	/* sanity check */
	if (escd.escd_size > MAX_SANE_ESCD_SIZE) {
		printk(KERN_ERR
		       "PnPBIOS: %s: ESCD size reported by BIOS escd_info call is too great\n", __func__);
		return -EFBIG;
	}

	tmpbuf = kzalloc(escd.escd_size, GFP_KERNEL);
	if (!tmpbuf)
		return -ENOMEM;

	if (pnp_bios_read_escd(tmpbuf, escd.nv_storage_base)) {
		kfree(tmpbuf);
		return -EIO;
	}

	escd_size =
	    (unsigned char)(tmpbuf[0]) + (unsigned char)(tmpbuf[1]) * 256;

	/* sanity check */
	if (escd_size > MAX_SANE_ESCD_SIZE) {
		printk(KERN_ERR "PnPBIOS: %s: ESCD size reported by"
				" BIOS read_escd call is too great\n", __func__);
		kfree(tmpbuf);
		return -EFBIG;
	}

	seq_write(m, tmpbuf, escd_size);
	kfree(tmpbuf);
	return 0;
}